Received: by 10.213.65.68 with SMTP id h4csp3288307imn; Mon, 9 Apr 2018 18:19:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/LpNgW84q0XORurS52ZB5Ixenvo6KF4jy/KgkUsaoEdq9H9SwRXPIXbyP4j3mNNEKU9HxT X-Received: by 10.101.66.76 with SMTP id d12mr22344517pgq.109.1523323144614; Mon, 09 Apr 2018 18:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523323144; cv=none; d=google.com; s=arc-20160816; b=xb3FhO3+CmTGVq9qe2aYZW9cW7e+GVnFPln/7ir4t/e1fP1JQ4nBjIQ6S0m7+J2TOt IdAEZ8lULRuYFyDhhOV7tXqKa4rRR631m0O/4CwxxV9PWpVGStZrB4SoxYzB9nlOhzds HOMD4d2buSIlc+uGZBCvxC99Z02Fs7C13KGz6wlwRfCJJkfK+TPeSSAsCIobbrZdsSY0 e/01AEL7MTZAcFAqZW1IgLKBSXvzwj9TzwPt5VQmsKWdguFPhGJ/6ZD2WxXzcpEcGGxQ tUMwmWp5TzUjVxfTLOT9D9fVvQv+FaPQQ24sG1lEDKanooYAxHV7UrBbhUb/4T9KcihD nZfw== 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=AnQFDDQISe1kt51OKqH9aU1bWlexCgjxRL8ysaLR7Ec=; b=Nb8Vpn6amf1G4TpBaGkaqBOZ3n3DcGdzCi9aB4rYq1JddnVgVQMINkJlX+nrhV32sl 04rhWfuCbNPIYXKHvRHKV31DiwoQgFUCWXEvSXD7E01Cws0FL7KFJVZ2OJtoi9WFNa7Y xRQr9ZhoHfVnKulIbEjRz87F18pS4TJ/K/f1vwdD3QTpygsYG7qksPEX0wLrZtBOCAs9 nPb8DyZeRXjjqyBUnieflQstINhGqDV5mHiCAGGBlewEqWH9BEH+M8JqLLM9chwSzM+U vTnc5eK8O51B7F35pePdWHv6bRyJoyz2JeuckQa3PCr/vkBgwtwTNlSewBcaPUtFMwVw dncA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MWJd+baH; 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 n10si1129272pfe.57.2018.04.09.18.18.27; Mon, 09 Apr 2018 18:19:04 -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=MWJd+baH; 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 S1751845AbeDJBPN (ORCPT + 99 others); Mon, 9 Apr 2018 21:15:13 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:33810 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751552AbeDJBPM (ORCPT ); Mon, 9 Apr 2018 21:15:12 -0400 Received: by mail-pl0-f66.google.com with SMTP id y12-v6so6200105plt.1; Mon, 09 Apr 2018 18:15:11 -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=AnQFDDQISe1kt51OKqH9aU1bWlexCgjxRL8ysaLR7Ec=; b=MWJd+baHAqYKJbfHPqxsjoHfph3d6p8InTSvowawDs+eqfMPD24/yv25yTjlYAvZ5Q nN1jhSlChMBn+llKo0Yp6TlVog2E/o5l8TXlcfVoCqTlk9vTbGv2K0+M46CiC32qhXGw 7qii0RsVPte07rDwpj2gyIt7Ia2VUknSIMfB3aTW0rdpzPmx3XU/f1QnIkyMRCSDM1d+ uKxvq3Fpvxg4L0ctg3GcciNGEnSkF8/1WvYEHO7ni5xbU7OMqX5/b/3UXn8UMqOiAzk5 l0FLAak0P0WB1LsgfpKZOuE9UiVBYBCwaNOMXZaxT6Ii+cJn3lxwycGNMQqBitXfmenK /Z8A== 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=AnQFDDQISe1kt51OKqH9aU1bWlexCgjxRL8ysaLR7Ec=; b=RIob03WLuMz0A8LSoKiiA7fmBVnydHZdPQzyBQxuzBRnMWQeEZXtRFnihrGnMa1Fg/ 1bZw1cJVl3CIG7hDhiH9c7K4fEHjTN2v4MMCtItDswEiAlqeW0TnXFTPi/2mIbTuzmqp FvXZVOIAPzs2Su8VLVk+pZFWwrHYU99kXw6F1BM+XHf8wIJXwTdpomorOrguyquRi1Q8 zk6PQ2Kiw0Gce3yHxIofCH2vg9PdWkBKVHSsKhB4o3TVwP2ZRd6YFCp0fN7DCKwD5/7s C42VaM5VA9G368i62WnYIV6YYHbOW4BCnui6wQFgWn6/qhm0CwjXjM7Q9PiN3TO77BCd zD5A== X-Gm-Message-State: AElRT7E9jTYeIs9xdX+rWSxbIbDY5r53CPODn8nluFLwzGOllWJdpbbu m5C3tpI2HBzuqdbcAvzq/yk= X-Received: by 2002:a17:902:4225:: with SMTP id g34-v6mr41907930pld.297.1523322911578; Mon, 09 Apr 2018 18:15:11 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:39e9:70fb:21a6:f4d2]) by smtp.gmail.com with ESMTPSA id x137sm2440813pfd.162.2018.04.09.18.15.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 18:15:11 -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: dccp: Replace GFP_ATOMIC with GFP_KERNEL in dccp_init Date: Tue, 10 Apr 2018 09:14:58 +0800 Message-Id: <1523322898-27833-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 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/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