From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jia-Ju Bai Subject: Re: [PATCH] net: decnet: Replace GFP_ATOMIC with GFP_KERNEL in dn_route_init Date: Mon, 9 Apr 2018 22:48:38 +0800 Message-ID: <92500938-e1c1-906c-58a7-404645df5b81@gmail.com> References: <1523283035-25639-1-git-send-email-baijiaju1990@gmail.com> <945ed4f2-e1e2-a038-2808-f18a79a35732@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-decnet-user@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: Eric Dumazet , davem@davemloft.net, kafai@fb.com, weiwan@google.com, dsa@cumulusnetworks.com, johannes.berg@intel.com, fw@strlen.de Return-path: In-Reply-To: <945ed4f2-e1e2-a038-2808-f18a79a35732@gmail.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 2018/4/9 22:44, Eric Dumazet wrote: > > On 04/09/2018 07:10 AM, Jia-Ju Bai wrote: >> dn_route_init() is never called in atomic context. >> >> The call chain ending up at dn_route_init() is: >> [1] dn_route_init() <- decnet_init() >> decnet_init() is only set as a parameter of module_init(). >> >> Despite never getting called from atomic context, >> dn_route_init() calls __get_free_pages() with GFP_ATOMIC, >> which waits busily for allocation. >> GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, >> to avoid busy waiting and improve the possibility of sucessful allocation. >> >> This is found by a static analysis tool named DCNS written by myself. >> And I also manually check it. >> >> Signed-off-by: Jia-Ju Bai >> --- >> net/decnet/dn_route.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c >> index 0bd3afd..59ed12a 100644 >> --- a/net/decnet/dn_route.c >> +++ b/net/decnet/dn_route.c >> @@ -1898,7 +1898,7 @@ void __init dn_route_init(void) >> while(dn_rt_hash_mask & (dn_rt_hash_mask - 1)) >> dn_rt_hash_mask--; >> dn_rt_hash_table = (struct dn_rt_hash_bucket *) >> - __get_free_pages(GFP_ATOMIC, order); >> + __get_free_pages(GFP_KERNEL, order); >> } while (dn_rt_hash_table == NULL && --order > 0); >> >> if (!dn_rt_hash_table) >> > This might OOM under pressure. Sorry, I do not understand this. Could you please explain the reason? > This would need __GFP_NOWARN | __GFP_NORETRY I guess, and would target net-next > Do you mean __get_free_pages(__GFP_NOWARN | __GFP_NORETRY) or __get_free_pages(__GFP_NOWARN | __GFP_NORETRY | GFP_KERNEL)? Best wishes, Jia-Ju Bai