From: Shmulik Ladkani <sladkani@cisco.com>
To: Mel Gorman <mgorman@suse.de>
Cc: Neil Brown <neilb@suse.de>, Eric Dumazet <eric.dumazet@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Concerns regarding PFMEMALLOC handling in __netdev_alloc_skb
Date: Thu, 28 Aug 2014 23:23:50 +0300 [thread overview]
Message-ID: <20140828232350.70684900@halley> (raw)
Hi,
>From c93bdd0e03 "netvm: allow skb allocation to use PFMEMALLOC reserves":
@@ -366,7 +417,12 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
if (fragsz <= PAGE_SIZE && !(gfp_mask & (__GFP_WAIT | GFP_DMA))) {
- void *data = netdev_alloc_frag(fragsz);
+ void *data;
+
+ if (sk_memalloc_socks())
+ gfp_mask |= __GFP_MEMALLOC;
+
+ data = __netdev_alloc_frag(fragsz, gfp_mask);
if (likely(data)) {
skb = build_skb(data, fragsz);
if (unlikely(!skb))
put_page(virt_to_head_page(data));
}
} else {
- skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, NUMA_NO_NODE);
+ skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask,
+ SKB_ALLOC_RX, NUMA_NO_NODE);
}
In the 'else' part, SKB_ALLOC_RX is provided to '__alloc_skb()'.
Thus '__alloc_skb()' may attempt using the PFMEMALLOC reserve in case
'sk_memalloc_socks()' is true - and 'skb->pfmemalloc' will be set
accordingly. Good.
However, in the 'if' part, in case 'sk_memalloc_socks()' is true,
__GFP_MEMALLOC is passed to '__netdev_alloc_frag()'.
There are two possible issues here:
1. '__netdev_alloc_frag()' might not honour __GFP_MEMALLOC in case the
frag fits into current netdev_alloc_cache.frag
2. Even if 'nc->frag.page' gets allocated/refilled, and __GFP_MEMALLOC
is passed to 'alloc_pages()' - in case the new page is from the
PFMEMALLOC reserve, that notion is not propagated to back to
skb->pfmemalloc.
Are these of any concern?
Regards,
Shmulik
next reply other threads:[~2014-08-28 20:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 20:23 Shmulik Ladkani [this message]
2014-08-28 21:34 ` Concerns regarding PFMEMALLOC handling in __netdev_alloc_skb 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=20140828232350.70684900@halley \
--to=sladkani@cisco.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=mgorman@suse.de \
--cc=neilb@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