Received: by 10.213.65.68 with SMTP id h4csp2669308imn; Mon, 9 Apr 2018 07:15:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx49agEGYN7mAHRJjlweaUoGtsnXoEFmaCWRvaV0JamXhmC13CbjdRmJ7OLTs1cDJ0tMdoom1 X-Received: by 2002:a17:902:7793:: with SMTP id o19-v6mr5879988pll.349.1523283306694; Mon, 09 Apr 2018 07:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523283306; cv=none; d=google.com; s=arc-20160816; b=HPsZVWr1Kwd2wVS2fiH3fOUxtIOXja6hqq1NNceLMI1AkeL/86D5JD5fY7cLxAxAIm g6bnz4MALpOLzeNyUERmRW+4/eyqR/x9WeZSfef8fhRHkA5RhYhr4e74D/Sp3PjJJJAy gkVwtxyQ9IuI/wKDRDZj3QZ5hkSKGgQw4sBSMv5aU84Hodel99KOTqesHfJh6Bf2caP7 YF3ZSmo8m7okIfC+bROTq8tHoI708PHbRw4Png77F5ucJibSTBbinrt8W7QlbhqOCbuJ L4hZQUi+FSqAXwl61PXZ4YN06WOx7IhqfpYm4rJcAF1m0PMfV17oZX9m6oAKpleAHTlZ zw9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=bzPAIsbDK4VRNF03sZCwRBDMzpOGdVY9oXs65MfG/yQ=; b=lLea//QRJAC3DGBP8rddiMXAyEUNL6a2lVN/mpH4r5NrM2EwHhmGfOPlrV7rj6yxqY xW5MzYLPn2+MmETV+O0rqwtRGgScaFvdS9aQ/dzGED9BWC2xJH5J3wbCZB2yDNfTb5Jt zGqpbP3mgo1yAuYQuh66BAegmlPF93Qo7YVY3twhn2AkSgm1jlK5dsNM+v9i9aY8zkSW FOxPs7cwydpdqi/bMm68Y4mPUPAxSSvEZ2FrUVuPqjmIzqEgpkwE0C30HUpCLVg2KUpx 1VGlr/Dxs7jok42wHiPeJityKltN6xiDpftuwhhTcCZdG+6biKy9Sd4e9TGSe3uV5CwX zWQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jbvdNbiZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si399426pld.280.2018.04.09.07.14.30; Mon, 09 Apr 2018 07:15:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jbvdNbiZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752249AbeDIOKQ (ORCPT + 99 others); Mon, 9 Apr 2018 10:10:16 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:42270 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbeDIOKO (ORCPT ); Mon, 9 Apr 2018 10:10:14 -0400 Received: by mail-pl0-f66.google.com with SMTP id t20-v6so2373404ply.9; Mon, 09 Apr 2018 07:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bzPAIsbDK4VRNF03sZCwRBDMzpOGdVY9oXs65MfG/yQ=; b=jbvdNbiZ4iSAXQitE7xvQH+u9aN1BNC2IXus+RQVK4yxtavq1VEoUeRa57x+JuDMKJ brl1xMbLBZODHHOk/PRdMWTKNs9VP2ch00PIF2RcLYG9/wGgCG0UEBU964CM2nWqZkX2 dIIwRGisWRHrBNlO8cK+3zwnFGV1NasQhXxRGsVhvSDJFUUawIzwm+r2p3527XvAkTdE 9JHkrks3HxDxx4+BNJ42vo/2GsoEACQj5oEjZjffbQTCbiMR8UAVU1qe2bftTasIcwsP /sGUJxhqPyt3EPrP5y6XSUXo5FNKuUHArGAc62/nJPx39Ip22BkAyrTGOmsYoLut94lO ITyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bzPAIsbDK4VRNF03sZCwRBDMzpOGdVY9oXs65MfG/yQ=; b=rqoKxBm/ZIX79G7jRo8Veqw9f6OGknJZY9NxKobLCQnry4e+ZO0Sjs3k+IJe/ha0Qu VFM1qfo9+hHbrfVm6exygC80h2rVNkRRdhHOjYddRXMGcddNCEO+ebTn1W4Fh4BeNdsx Bw2e5M2jPGRVSpi0YgRuigss4DraV58JobZyz80sfoWcWEE+LpV1jWm0rzaI7N7l27G2 0xpD5kgISj96YCI8lpVySVqpRMIApsOg+UkA7TqHL9lu1gispX4M/ZB0kBMl1XxIAUsr OOgfSs5isASiE0NEmn8SNcqocsV0jcav42C/ahNu9uSn3+CuuEOnVsARl2+0zLgEF13l IYVA== X-Gm-Message-State: AElRT7GB/0DRXlaXhiRaoP1EInXN69VK3ZjQKxvDGRdt/l26UiaWEVRq 7MUqUxrPikfiqpseBoCPQoI= X-Received: by 2002:a17:902:6bca:: with SMTP id m10-v6mr39286946plt.387.1523283013380; Mon, 09 Apr 2018 07:10:13 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:39e9:70fb:21a6:f4d2]) by smtp.gmail.com with ESMTPSA id h62sm1857384pgc.61.2018.04.09.07.10.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 07:10:12 -0700 (PDT) From: Jia-Ju Bai To: gerrit@erg.abdn.ac.uk, davem@davemloft.net Cc: dccp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: dccp: Replace GFP_ATOMIC with GFP_KERNEL in dccp_init Date: Mon, 9 Apr 2018 22:10:04 +0800 Message-Id: <1523283004-25581-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dccp_init() is never called in atomic context. This function is only set as a parameter of module_init(). Despite never getting called from atomic context, dccp_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/dccp/proto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/dccp/proto.c b/net/dccp/proto.c index b68168f..f63ba93 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -1159,7 +1159,7 @@ static int __init dccp_init(void) hash_size--; dccp_hashinfo.ehash_mask = hash_size - 1; dccp_hashinfo.ehash = (struct inet_ehash_bucket *) - __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, ehash_order); + __get_free_pages(GFP_KERNEL|__GFP_NOWARN, ehash_order); } while (!dccp_hashinfo.ehash && --ehash_order > 0); if (!dccp_hashinfo.ehash) { @@ -1182,7 +1182,7 @@ static int __init dccp_init(void) bhash_order > 0) continue; dccp_hashinfo.bhash = (struct inet_bind_hashbucket *) - __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, bhash_order); + __get_free_pages(GFP_KERNEL|__GFP_NOWARN, bhash_order); } while (!dccp_hashinfo.bhash && --bhash_order >= 0); if (!dccp_hashinfo.bhash) { -- 1.9.1