From: Govindarajulu Varadarajan <_govind@gmx.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, mgorman@suse.de,
Govindarajulu Varadarajan <_govind@gmx.com>
Subject: [PATCH RFC net-next 2/2] net: skbuff: do not allocate emergency memory if flags is not __GFP_MEMALLOC
Date: Sun, 24 Aug 2014 03:07:19 +0530 [thread overview]
Message-ID: <1408829839-20742-3-git-send-email-_govind@gmx.com> (raw)
In-Reply-To: <1408829839-20742-1-git-send-email-_govind@gmx.com>
It is possible that nc->frag.page is previously allocated from emergency memory.
For new alloc call, if the flags does not contain __GFP_MEMALLOC, do not
return pfmemalloc memory.
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
net/core/skbuff.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 51a3328..792ce89 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -364,6 +364,13 @@ recycle:
atomic_set(&nc->frag.page->_count, NETDEV_PAGECNT_MAX_BIAS);
nc->pagecnt_bias = NETDEV_PAGECNT_MAX_BIAS;
nc->frag.offset = 0;
+ } else if (nc->frag.page->pfmemalloc && !(gfp_mask & __GFP_MEMALLOC)) {
+ if (atomic_sub_and_test(nc->pagecnt_bias,
+ &nc->frag.page->_count)) {
+ atomic_set(&nc->frag.page->_count, 1);
+ kfree(page_address(nc->frag.page));
+ }
+ goto refill;
}
if (nc->frag.offset + fragsz > nc->frag.size) {
--
2.1.0
next prev parent reply other threads:[~2014-08-23 21:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-23 21:37 [PATCH RFC net-next 0/2] Fix pfmemalloc in __netdev_alloc_skb Govindarajulu Varadarajan
2014-08-23 21:37 ` [PATCH RFC net-next 1/2] net: skbuff: propagate pfmemalloc to skb Govindarajulu Varadarajan
2014-08-23 23:51 ` Eric Dumazet
2014-08-23 21:37 ` Govindarajulu Varadarajan [this message]
2014-08-23 23:53 ` [PATCH RFC net-next 2/2] net: skbuff: do not allocate emergency memory if flags is not __GFP_MEMALLOC Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408829839-20742-3-git-send-email-_govind@gmx.com \
--to=_govind@gmx.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=mgorman@suse.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).