OpenCloudOS-Kernel/drivers/net/ethernet
Michal Hocko 2f064f3485 mm: make page pfmemalloc check more robust
Commit c48a11c7ad ("netvm: propagate page->pfmemalloc to skb") added
checks for page->pfmemalloc to __skb_fill_page_desc():

        if (page->pfmemalloc && !page->mapping)
                skb->pfmemalloc = true;

It assumes page->mapping == NULL implies that page->pfmemalloc can be
trusted.  However, __delete_from_page_cache() can set set page->mapping
to NULL and leave page->index value alone.  Due to being in union, a
non-zero page->index will be interpreted as true page->pfmemalloc.

So the assumption is invalid if the networking code can see such a page.
And it seems it can.  We have encountered this with a NFS over loopback
setup when such a page is attached to a new skbuf.  There is no copying
going on in this case so the page confuses __skb_fill_page_desc which
interprets the index as pfmemalloc flag and the network stack drops
packets that have been allocated using the reserves unless they are to
be queued on sockets handling the swapping which is the case here and
that leads to hangs when the nfs client waits for a response from the
server which has been dropped and thus never arrive.

The struct page is already heavily packed so rather than finding another
hole to put it in, let's do a trick instead.  We can reuse the index
again but define it to an impossible value (-1UL).  This is the page
index so it should never see the value that large.  Replace all direct
users of page->pfmemalloc by page_is_pfmemalloc which will hide this
nastiness from unspoiled eyes.

The information will get lost if somebody wants to use page->index
obviously but that was the case before and the original code expected
that the information should be persisted somewhere else if that is
really needed (e.g.  what SLAB and SLUB do).

[akpm@linux-foundation.org: fix blooper in slub]
Fixes: c48a11c7ad ("netvm: propagate page->pfmemalloc to skb")
Signed-off-by: Michal Hocko <mhocko@suse.com>
Debugged-by: Vlastimil Babka <vbabka@suse.com>
Debugged-by: Jiri Bohac <jbohac@suse.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: <stable@vger.kernel.org>	[3.6+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-08-21 14:30:10 -07:00
..
3com 3c59x: Fix resource leaks in vortex_open 2015-08-03 15:21:33 -07:00
8390 drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
adaptec drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
adi drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
aeroflex net: greth: constify of_device_id array 2015-03-17 15:00:22 -04:00
agere drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
allwinner drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
alteon drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
altera altera_tse: Correct rx packet length 2015-04-29 15:19:34 -04:00
amd amd-xgbe: Fix DMA API debug warning 2015-07-08 15:57:14 -07:00
apm drivers: net: xgene: Pre-initialize ret in xgene_enet_get_resources() 2015-06-28 16:54:32 -07:00
apple drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
arc drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
atheros drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
broadcom bnx2x: Free NVRAM lock at end of each page 2015-08-10 14:31:59 -07:00
brocade bna: fix interrupts storm caused by erroneous packets 2015-08-10 10:58:37 -07:00
cadence macb: Fix build with macro'ized readl/writel. 2015-07-27 14:24:48 -07:00
calxeda ethernet: codespell comment spelling fixes 2015-03-08 22:54:22 -04:00
cavium net: thunderx: remove effective "default y" from Kconfig if ARCH_THUNDER=y 2015-08-07 00:01:37 -07:00
chelsio cxgb4: missing curly braces in t4_setup_debugfs() 2015-08-10 14:26:26 -07:00
cirrus drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
cisco enic: fix issues in enic_poll 2015-07-02 12:10:20 -07:00
davicom dm9000: Add regulator and reset support to dm9000 2015-01-15 14:08:07 -05:00
dec drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
dlink drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
emulex be2net: avoid vxlan offloading on multichannel configs 2015-08-17 14:29:58 -07:00
ezchip NET: Add ezchip ethernet driver 2015-06-23 07:16:25 -07:00
faraday drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
freescale gianfar: Restore link state settings after MAC reset 2015-08-13 21:26:23 -07:00
fujitsu drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
hisilicon drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
hp drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
i825xx drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
ibm drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
icplus net: icplus: fix typo in constant name 2015-06-29 15:57:50 -07:00
intel mm: make page pfmemalloc check more robust 2015-08-21 14:30:10 -07:00
marvell net: mvpp2: replace TX coalescing interrupts with hrtimer 2015-08-10 10:57:00 -07:00
mellanox net/mlx5_core: Set log_uar_page_sz for non 4K page size architecture 2015-08-07 15:55:48 -07:00
micrel net: ethernet: micrel: fix an error code 2015-08-17 12:23:22 -07:00
microchip drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
moxa drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
myricom Minor merge needed, due to function move. 2015-07-01 10:49:25 -07:00
natsemi drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
neterion drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
nuvoton drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
nvidia drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
nxp
octeon netdev: octeon_mgmt: constify of_device_id array 2015-03-17 15:00:22 -04:00
oki-semi drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
packetengines drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
pasemi drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
qlogic qlcnic: Fix corruption while copying 2015-07-29 23:57:26 -07:00
qualcomm drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
rdc drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
realtek r8169: enforce RX_MULTI_EN on rtl8168ep/8111ep chips 2015-08-07 00:00:10 -07:00
renesas ravb: fix ring memory allocation 2015-07-21 22:34:27 -07:00
rocker rocker: free netdevice during netdevice removal 2015-08-02 17:19:17 -07:00
samsung ethernet: codespell comment spelling fixes 2015-03-08 22:54:22 -04:00
seeq drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
sfc sfc: Report TX completions to BQL after all TX events in interrupt 2015-07-09 00:00:40 -07:00
sgi drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
silan drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
sis sis900: Trivial: Fix typos in enums 2015-06-29 12:52:06 -07:00
smsc drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
stmicro stmmac: dwmac-ipq806x: fix static checker warning 2015-08-07 00:12:04 -07:00
sun niu: don't count tx error twice in case of headroom realloc fails 2015-07-26 21:17:54 -07:00
tehuti drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
ti net: netcp: fix unused interface rx buffer size configuration 2015-08-07 00:02:36 -07:00
tile net: batch of last_rx update avoidance in ethernet drivers. 2015-05-14 17:38:17 -04:00
toshiba drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
tundra drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
via net: via: VIA_RHINE and VIA_VELOCITY should depend on HAS_DMA 2015-06-28 20:20:55 -07:00
wiznet drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
xilinx net: axienet: Fix devm_ioremap_resource return value check 2015-07-09 21:43:16 -07:00
xircom drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
xscale drivers/net: remove all references to obsolete Ethernet-HOWTO 2015-06-23 06:50:35 -07:00
Kconfig NET: Add ezchip ethernet driver 2015-06-23 07:16:25 -07:00
Makefile NET: Add ezchip ethernet driver 2015-06-23 07:16:25 -07:00
dnet.c net: dnet: fix dnet_poll() 2015-01-11 21:44:55 -05:00
dnet.h
ec_bhf.c
ethoc.c net: ethoc: constify of_device_id array 2015-03-17 15:00:21 -04:00
fealnx.c
jme.c net: rename vlan_tx_* helpers since "tx" is misleading there 2015-01-13 17:51:08 -05:00
jme.h
korina.c
lantiq_etop.c
netx-eth.c