From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756816AbaBFVDI (ORCPT ); Thu, 6 Feb 2014 16:03:08 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:42348 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbaBFVDG (ORCPT ); Thu, 6 Feb 2014 16:03:06 -0500 Date: Thu, 6 Feb 2014 13:03:03 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Joe Perches cc: Eric Dumazet , David Miller , netdev , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] net: use __GFP_NORETRY for high order allocations In-Reply-To: <1391718270.15777.20.camel@joe-AO722> Message-ID: References: <1391712162.10160.8.camel@edumazet-glaptop2.roam.corp.google.com> <1391718270.15777.20.camel@joe-AO722> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Feb 2014, Joe Perches wrote: > On Thu, 2014-02-06 at 10:42 -0800, Eric Dumazet wrote: > > sock_alloc_send_pskb() & sk_page_frag_refill() > > have a loop trying high order allocations to prepare > > skb with low number of fragments as this increases performance. > > > > Problem is that under memory pressure/fragmentation, this can > > trigger OOM while the intent was only to try the high order > > allocations, then fallback to order-0 allocations. > [] > > Call Trace: > > [] dump_header+0xe1/0x23e > > [] oom_kill_process+0x6a/0x323 > > [] out_of_memory+0x4b3/0x50d > > [] __alloc_pages_may_oom+0xa2/0xc7 > > [] __alloc_pages_nodemask+0x1002/0x17f0 > > [] alloc_pages_current+0x103/0x2b0 > > [] sk_page_frag_refill+0x8f/0x160 > [] > > diff --git a/net/core/sock.c b/net/core/sock.c > [] > > @@ -1775,7 +1775,9 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len, > > while (order) { > > if (npages >= 1 << order) { > > page = alloc_pages(sk->sk_allocation | > > - __GFP_COMP | __GFP_NOWARN, > > + __GFP_COMP | > > + __GFP_NOWARN | > > + __GFP_NORETRY, > > order); > > if (page) > > goto fill_page; > > @@ -1845,7 +1847,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio) > > gfp_t gfp = prio; > > > > if (order) > > - gfp |= __GFP_COMP | __GFP_NOWARN; > > + gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY; > > Perhaps add __GFP_THISNODE too ? > How does __GFP_THISNODE have anything to do with avoiding oom killing due to high-order fragmentation? If they absolutely require local memory to currnet's cpu node then that would make sense, but the fallback still allocates order-0 memory remotely and with __GFP_THISNODE on this attempt we wouldn't even attempt remote reclaim.