stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "net: do not deplete pfmemalloc reserve" has been added to the 4.0-stable tree
@ 2015-04-29 10:12 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-04-29 10:12 UTC (permalink / raw)
  To: edumazet, davem, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    net: do not deplete pfmemalloc reserve

to the 4.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-do-not-deplete-pfmemalloc-reserve.patch
and it can be found in the queue-4.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From foo@baz Wed Apr 29 11:59:49 CEST 2015
From: Eric Dumazet <edumazet@google.com>
Date: Wed, 22 Apr 2015 07:33:36 -0700
Subject: net: do not deplete pfmemalloc reserve

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 79930f5892e134c6da1254389577fffb8bd72c66 ]

build_skb() should look at the page pfmemalloc status.
If set, this means page allocator allocated this page in the
expectation it would help to free other pages. Networking
stack can do that only if skb->pfmemalloc is also set.

Also, we must refrain using high order pages from the pfmemalloc
reserve, so __page_frag_refill() must also use __GFP_NOMEMALLOC for
them. Under memory pressure, using order-0 pages is probably the best
strategy.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/skbuff.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -311,7 +311,11 @@ struct sk_buff *build_skb(void *data, un
 
 	memset(skb, 0, offsetof(struct sk_buff, tail));
 	skb->truesize = SKB_TRUESIZE(size);
-	skb->head_frag = frag_size != 0;
+	if (frag_size) {
+		skb->head_frag = 1;
+		if (virt_to_head_page(data)->pfmemalloc)
+			skb->pfmemalloc = 1;
+	}
 	atomic_set(&skb->users, 1);
 	skb->head = data;
 	skb->data = data;
@@ -348,7 +352,8 @@ static struct page *__page_frag_refill(s
 	gfp_t gfp = gfp_mask;
 
 	if (order) {
-		gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY;
+		gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY |
+			    __GFP_NOMEMALLOC;
 		page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
 		nc->frag.size = PAGE_SIZE << (page ? order : 0);
 	}


Patches currently in stable-queue which might be from edumazet@google.com are

queue-4.0/net-rfs-fix-crash-in-get_rps_cpus.patch
queue-4.0/net-fix-crash-in-build_skb.patch
queue-4.0/tcp-avoid-looping-in-tcp_send_fin.patch
queue-4.0/net-do-not-deplete-pfmemalloc-reserve.patch
queue-4.0/tcp-fix-possible-deadlock-in-tcp_send_fin.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-29 10:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-29 10:12 Patch "net: do not deplete pfmemalloc reserve" has been added to the 4.0-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).