linux_dsm_epyc7002/drivers/net/ethernet/intel/fm10k
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
..
fm10k_common.c fm10k: Resolve various spelling errors and checkpatch warnings 2015-03-03 01:07:23 -08:00
fm10k_common.h fm10k: Add support for ptp to hw specific files 2014-09-23 03:59:22 -07:00
fm10k_dcbnl.c fm10k: fix unused warnings 2015-04-14 15:23:36 -07:00
fm10k_debugfs.c fm10k: fix unused warnings 2015-04-14 15:23:36 -07:00
fm10k_ethtool.c fm10k: Fix missing braces after if statement 2015-06-17 14:21:41 -07:00
fm10k_iov.c fm10k: force LPORT delete when updating VLAN or MAC address 2015-06-17 14:21:15 -07:00
fm10k_main.c mm: make page pfmemalloc check more robust 2015-08-21 14:30:10 -07:00
fm10k_mbx.c fm10k: remove err_no reference in fm10k_mbx.c 2015-06-17 14:21:30 -07:00
fm10k_mbx.h fm10k: Add support for PF <-> VF mailbox 2014-09-23 03:59:20 -07:00
fm10k_netdev.c fm10k: remove extraneous NULL check on l2_accel 2015-06-17 14:20:56 -07:00
fm10k_pci.c fm10k: use dma_set_mask_and_coherent in fm10k_probe 2015-06-17 14:21:10 -07:00
fm10k_pf.c fm10k: fix iov_msg_lport_state_pf issue 2015-06-17 14:21:36 -07:00
fm10k_pf.h fm10k: pack TLV overlay structures 2015-06-17 14:21:22 -07:00
fm10k_ptp.c fm10k: fix incorrect free on skb in ts_tx_enqueue 2015-06-17 14:20:36 -07:00
fm10k_tlv.c fm10k: Resolve various spelling errors and checkpatch warnings 2015-03-03 01:07:23 -08:00
fm10k_tlv.h fm10k: Add support for mailbox 2014-09-23 03:59:14 -07:00
fm10k_type.h fm10k: fix incorrect DIR_NEVATIVE bit in 1588 code 2015-06-17 14:21:26 -07:00
fm10k_vf.c fm10k: Have the VF get the default VLAN during init 2015-04-14 15:07:27 -07:00
fm10k_vf.h fm10k: Add support for ptp to hw specific files 2014-09-23 03:59:22 -07:00
fm10k.h fm10k: use separate workqueue for fm10k driver 2015-04-14 15:38:06 -07:00
Makefile fm10k: Add support for PTP 2014-09-23 03:59:23 -07:00