Received: by 10.213.65.68 with SMTP id h4csp3288715imn; Mon, 9 Apr 2018 18:19:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+74TCjt1Ft+Vet3I2SqtatmStPqcG+pwdG5hG5Tj1BkaLbzOCeIqMZstR7r7eUR8AmsU55 X-Received: by 10.167.134.80 with SMTP id a16mr983597pfo.172.1523323181781; Mon, 09 Apr 2018 18:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523323181; cv=none; d=google.com; s=arc-20160816; b=gsq2AYyWjrk3TR6hHRaMdn6s8Uy1VMgsd1bb/JZSTGc5HPwAS6Bc3Vp6dISqLt/cvb TLOYfozqao7mFTpR1GNzgZnbDWFj7w0fDyNXjd6OaqHH1+S3guwThJ6Yc9YRNIUQphga OiqP6scdOEdNvSd7JZZTj8HoNG3IUMxHRL3EAT4pHUoJbYHNkZCLT1kbOGaeuWKi7dIp HYuAwYCBr99ATUCepgqXIdCJByS3AjE+a+LwdbglaAsvB+R+v6mw2UE29yx6LD5o+2D1 G9NRP1rXWWDcdQJ/BwFW1tdu10ozAZ7St5lNH7Z7K+uBBNoNXRj3tGSuzQFNlO89iKnQ MqiQ== 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=bwpzCLjbmfd8vD2qQbLABKkzFLl2FBtZzLvU7Q+Q9M8gIIWPLTAMFVZNLmYtuJrtlt t5nZHLkNO9a3jVdTqE7U2QR5BrpCfse0y8TF9cxgdurvTgW4VYEAqShy1FCb+DpS2W7Q nLe22nHZ7Ibs7w2fRaX/CTBQOu4ttpdsijyHWHREPaWaeaIvrBvNCTqS/saMrHpZKX9c 4JxKD1cKy9+RV2lPaixWi8ob2t4VTimo/h87ffUvnfRR/T4zCH+z4EPRGOWtmQogq2Rh EMMw0soPeoof/FtdcV2fj16OEG0sMfJ211nSgY53vKykC/bPacwraeM2pZEtZPmKRU/6 JS3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eUXdifzh; 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 e15si1013504pgu.656.2018.04.09.18.19.04; Mon, 09 Apr 2018 18:19:41 -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=eUXdifzh; 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 S1752078AbeDJBPs (ORCPT + 99 others); Mon, 9 Apr 2018 21:15:48 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:35130 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbeDJBPr (ORCPT ); Mon, 9 Apr 2018 21:15:47 -0400 Received: by mail-pl0-f68.google.com with SMTP id 61-v6so6302249plb.2; Mon, 09 Apr 2018 18:15:46 -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=eUXdifzhwZMwWb++0SYb2UMrqCDviYXhGEfGe/ijiSqUpt1VjAjeDNslibacljhn5B ZNIFMPWAnOrtzMhJcmq6oSve5qTQCnvnmZGG781yeMVsfZo1IjPQKn/8YMnn8hDVO4uT XlzZAJw7akDXaVIZvXdu7uIvSg4ciLavuNfu+/qCmkLBr4vpvel2x0TVDN1q6okSf2Tw Tf2+7h1WCh7x1bGGreCyZDk1Hk2k0sjN86HejsnvbeK74YuHwZUGuNQYkpnlraVPuBwk fxB3koYtYZXHJWAYPA3zIpaoHcdt35l/XzP/eI/dJinBrtjVtSvVeIoZN3J8Lc6bxFGX cz/w== 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=Z8tmt8Ql0WYodKw4WKLqJ5tZxCTKR0KXO+XT5Z/1XXXMfnLub2W6yHEBRFEkpzRrFg u8fkjed4hQmQ8AesIswCDgLy8Bf3r03ZdsksgL1g4WmKiLwU5D+5JJzAT8RfSjIiuZwz gqGt92NS7rKLQWvMrikuNy692fPsjxmR9X+0bmAlMo8gpHlLs2cm5NQCj6TzGwBQuTFO bfbGyv5LNNOrhMM/0oAX8NJsAnTOKIyxSUkjeLPHjGspa76N7pPhxLTGtIuVNeyr1OAy vrg8nD67sJ4pqfqZpLS9H3Vhtt1xVlUoH2mZ4jwdJHDigG9jnlYLtr5A0Z/jj4Uj5mHV 7+gg== X-Gm-Message-State: ALQs6tDynA2rZwXcdPSCQZFhXPf+wwZs3Ck77qhusJeLzFWfMqL/z/OS wf8HtigbsfnkG727arH3gzCxpg== X-Received: by 2002:a17:902:d20b:: with SMTP id t11-v6mr11552779ply.381.1523322946596; Mon, 09 Apr 2018 18:15:46 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:39e9:70fb:21a6:f4d2]) by smtp.gmail.com with ESMTPSA id j125sm2918949pfg.188.2018.04.09.18.15.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 18:15:46 -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 v2] net: decnet: Replace GFP_ATOMIC with GFP_KERNEL in dn_route_init Date: Tue, 10 Apr 2018 09:15:40 +0800 Message-Id: <1523322940-27892-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