Received: by 10.213.65.68 with SMTP id h4csp3291187imn; Mon, 9 Apr 2018 18:23:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Y0m9h2iMReYKGY6x6qkL5AFy5Qdj76zLEan5yB67rFagnMzzMA2xBJlYeDldeNZiHARUL X-Received: by 10.98.234.6 with SMTP id t6mr1002972pfh.38.1523323380126; Mon, 09 Apr 2018 18:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523323380; cv=none; d=google.com; s=arc-20160816; b=c7d7rNaDlQhSReUkWNJUSpAHGxWyWu1peiNz6WZfqXeehEIbtFuCu5+sb6mEzJtR8/ 8GWr3i2udh7iBSZKQkyaeDgI6V1MpVmxv+OM/g2jAXt4saN40JzcoAFQAoF5tCR+I0Df tOxumruMvAux75REgw0gcb1JKEkvZL4dbeQHN+KOq9Mdix01Mw19omwNBUQBgsnqvDVa qGtpL+kbd2Rcywo5Zk/px8KuU75BtJRyE0ntJEgnelOalS49fsPooVbIwPDriXSCJMMD KImrFSFR5HTTXSwDVNnoKd1UCbl2CeaRR1JC0hlZz4am/S/YAdJGWd0SAdLWP27n5Brh 39xA== 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=nhy8hHvXD7V5BloYv+FwOcoN/EmDqIuQ/f5kQ/vwU9g=; b=CNf4SqClLEkInJnkh14NK++wlgQg5MvrUkLf4Hjf98wqSjrkRkJBvxtcI+xok7sAmH 299La7+F+MK0PDsJOaoV0kxW5EOqwCV3P3xZwEyag8MvCgbu2lXAqFx2EIEwffgcwQhH lLFXNYSK6NvgI0BC/dtl6Oro9KWHfSGj3+r4KWlYU5O1lv5dzKQuK/MN/A8FznHfaQaj HkzysgsNG5uILQii+74wH2z3TfID+MKRyyyPgsA54wi3i+snOzTtEgViiYVhPZg1PR7/ fclSaQJUaEBoDUO+FWQIgq96DC01FJK1C+LZ22r6mpsb1XDfuaYC4RbG5y5HgklsoJ6A AmVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WYxX8Ueg; 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 m24si1161796pfj.264.2018.04.09.18.22.23; Mon, 09 Apr 2018 18:23:00 -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=WYxX8Ueg; 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 S1752501AbeDJBSY (ORCPT + 99 others); Mon, 9 Apr 2018 21:18:24 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:33201 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752083AbeDJBSX (ORCPT ); Mon, 9 Apr 2018 21:18:23 -0400 Received: by mail-pl0-f68.google.com with SMTP id s10-v6so6310643plp.0; Mon, 09 Apr 2018 18:18:23 -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=nhy8hHvXD7V5BloYv+FwOcoN/EmDqIuQ/f5kQ/vwU9g=; b=WYxX8UegM8RUZKt1ioj/S5aZE81H1SnF+TZ/eD3ZIpPXfb4h5dwqqcaxStb2YhOr27 oZsSsWYKOGNgmAsxTTBMyT8kbHg2X/kY7un/1sMqMRAIkdUN8VURIfMNhimpnd/oJR5e w1IzmL7OsSabn2H3rtNB0T4rG2SV96FkhvcFxf5vJK7j6HMfL4soIdIvRFyQ+aUdwlvI CbX4nNzpVuBgaDngc7fzLjbLxRByanDztZn5CFN1Xn+GQGvVF0JqCYLWqgg1xJIe6NDC NQ9IwgbE1MaPFO787vyozfagD6y0FWCXZUNyk3FrhgJSNH/AksQOgPx9UcLHNpOWio66 pnfA== 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=nhy8hHvXD7V5BloYv+FwOcoN/EmDqIuQ/f5kQ/vwU9g=; b=RKCvuMQTveDKh2YhxLMDYzuR2OohegFuKGU0gJ/twHxX8N0pgys3Ca3hgDTVmlZMDl /5kDYrG6iWM9sifFNsONMo4LIvXEFC0T40Eh0vkL33LmdepzmxKcb5cfkz73bsvhotkR RJyoglBsY7l7LW79AJaMdacle0jkAuo+zt/eOw0hDd2FeH3ovQeyolcbmgNKDWGdlBMf aOCyZccbNwGbbMMBuGHpvvmHwpoU/eCF7M83wLNR3rUmcq2q1tjMVBy4qRoAKTSyk0ap 938zjBSdlyW8gQbuSaVFQmA2K4jx7vJQa+zoLJMK2HQALVNa4yrhWLY+0y+advUkJKry ieyA== X-Gm-Message-State: AElRT7GbdJ5QIzyt7Br/0U+WGQT7zJtwj6v8mW28zeZw9SEOXAv2VNO+ QnTnv+m7MHXHxYFCuXxsQRY= X-Received: by 2002:a17:902:8602:: with SMTP id f2-v6mr40072945plo.73.1523323103040; Mon, 09 Apr 2018 18:18:23 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:39e9:70fb:21a6:f4d2]) by smtp.gmail.com with ESMTPSA id t14sm2671521pfa.74.2018.04.09.18.18.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 18:18:22 -0700 (PDT) From: Jia-Ju Bai To: davem@davemloft.net, weiwan@google.com, kafai@fb.com, hannes@stressinduktion.org, fw@strlen.de, dsa@cumulusnetworks.com, johannes.berg@intel.com Cc: linux-decnet-user@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH v2] net: decnet: Replace GFP_ATOMIC with GFP_KERNEL in dn_route_init Date: Tue, 10 Apr 2018 09:18:13 +0800 Message-Id: <1523323093-28196-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 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 does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep 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 --- v2: * Modify the description of GFP_ATOMIC in v1. Thank Eric for good advice. --- 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) -- 1.9.1