Received: by 10.213.65.68 with SMTP id h4csp3896673imn; Tue, 10 Apr 2018 06:22:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx49pPVI7Y7tmPTRhu1CtCOQtqsKXoRh096VdOU1PRdCbcjp+I0E/FbDcrMwUdxLWo/Tcs72q X-Received: by 10.99.95.214 with SMTP id t205mr286191pgb.145.1523366534045; Tue, 10 Apr 2018 06:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523366534; cv=none; d=google.com; s=arc-20160816; b=EDHzRexszJ3HNxiL21Wu1BXTkEhomiVqBjdMe0wzl7c4V4CX2UBc9aIeg6Hhowwv+M xH2Bsv+e1m8Sxun6CRpL9OFvo+/yatEubR6yg7Kh+4x29UA4HxqrvTAUrbmC7vxjINzb BjG9naJ5Jv3ewOz2Zf8DEB/tQvnmz+my/P7hE7dirPUn03xcqAL19LQor42O387C2QuP Kscdb91KSfMe1sRxutlVcxd7pKCoCh01lvM5BY1yswQqPbK4zzyyw26fU3MX24pBMk1e ZoPUQrHFZLZtoH3EiJQ09ThpFf8yrdQn45eEGGdsjkzclrEqC/EBTWAxV8yJoRvtILJs Mq6Q== 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=rNJ0WAdNTTYBFR0LC4yNgzPVuGwy4Fz1hz1It9Z+WQg=; b=ucn8ucRCoQ/yvSIPWM/tp2dJvK+NarzxoMfW0m+stkV+4F05ahubmpg6pRiBaN6gZt Azjuubc26IV7jnGPfwvHrSEGUKisCf1FhKvXs4S65lfN9gjMYFv8wC9aV3In1rAx3Ilw 4+O4isy9/YUiIM8mRYdNh9VJVKK6vv6kHZ3Sh6CWraaq41p6m8UFYsK4MZDKMKYGd+pE xdNXsClrYhP+OxQN/wzN4fkcTMV3fPqix7v152P4YdJVXWswrSm31qCw51ncaKS8be46 QkltADNsaWwKKyE65tX2hYrPgD6hQnETRyc3U+Gi8ci0TLkugq51b2O0/QPkMVrSSu3p iP8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SluetGOQ; 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 x4-v6si2796488plr.391.2018.04.10.06.21.36; Tue, 10 Apr 2018 06:22:14 -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=SluetGOQ; 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 S1753224AbeDJNRm (ORCPT + 99 others); Tue, 10 Apr 2018 09:17:42 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37122 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752753AbeDJNRl (ORCPT ); Tue, 10 Apr 2018 09:17:41 -0400 Received: by mail-pf0-f194.google.com with SMTP id p6so4719783pfn.4 for ; Tue, 10 Apr 2018 06:17:39 -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=rNJ0WAdNTTYBFR0LC4yNgzPVuGwy4Fz1hz1It9Z+WQg=; b=SluetGOQQvHq5LGM7RaOl34cwDPY47rovq3OYv13H748gL20DtEptjilOckYHWvMdq GRPEVqtq3fTsq0d20LJewDzJ1rLQQi1DxnCZRmOUtYC5G9tzGN1LwlosgCY3Hg4ZT5RW WlAMaQPBGWP8kSJvJUcjh7VQmBxljbIDWc8R1ymspxSTwIJ3LdifrlHBe0lpOq5zb+wM 4Ieh4uwjsVtO4jYJobayoUMDsoPULvzRKqc+U2biaaRn7J0fyd8NZMI2kARaibu++50o TsRff8yKyD9ZynOj+mRZvYSd51nmkJzACjx6Ugpfu9cyjoBMc1ZB8JhgFg8RwCPqbajG fQEA== 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=rNJ0WAdNTTYBFR0LC4yNgzPVuGwy4Fz1hz1It9Z+WQg=; b=CIeVBfXbp//ALM4LaMZYKM6GWlANjVlZjLmSqVfIXQMHPfDjxSNM+3oyNp52NjgqeS 0TlEUeVMEFrHoUgvuCnNH5jRvBfUlxmlGxR8goWXwLMEr2T/p4TdyFYA49DHuF19fnNm W0i6OeoPZii6SAT0o9mv3/Lx5tT73PUufYa/7xx+1WFBEc/2XPuRq3mzSEpIVKS0FvxI qaAZBuVMBQuqi0a9nzrdmeNpfwJ3gDK7Kr0+WiVQ7xaZa0RK2GphdeUwDob5Z010mHLU amRlBnznd04a7WuJFv4rb0E27c6BRqc6Ae2k8VovK5SZ8H1Eb/vV6CEUZE/tQ22FOl1l U4VA== X-Gm-Message-State: ALQs6tCnXnYnBjYLwjHTzxay34/wm6S7HAgiSVSlPoZRE99FD6rkuRyF Itdf7UzwGr2M8Rv3uHWsVa+VPXRL X-Received: by 10.99.109.139 with SMTP id i133mr292094pgc.174.1523366259272; Tue, 10 Apr 2018 06:17:39 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id v63sm8060316pfk.8.2018.04.10.06.17.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 06:17:38 -0700 (PDT) From: Jia-Ju Bai To: jdmason@kudzu.us, dave.jiang@intel.com, Allen.Hubbe@emc.com Cc: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/2] ntb: ntb_transport: Replace GFP_ATOMIC with GFP_KERNEL in ntb_transport_setup_qp_mw Date: Tue, 10 Apr 2018 21:17:29 +0800 Message-Id: <1523366249-31692-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 ntb_transport_setup_qp_mw() is never called in atomic context. ntb_transport_setup_qp_mw() is only called by ntb_transport_link_work(), which is set as a parameter of INIT_DELAYED_WORK() in ntb_transport_probe(). Despite never getting called from atomic context, ntb_transport_setup_qp_mw() calls kzalloc_node() 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 --- drivers/ntb/ntb_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index f58d8e3..08c9157 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c @@ -639,7 +639,7 @@ static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt, */ node = dev_to_node(&ndev->dev); for (i = qp->rx_alloc_entry; i < qp->rx_max_entry; i++) { - entry = kzalloc_node(sizeof(*entry), GFP_ATOMIC, node); + entry = kzalloc_node(sizeof(*entry), GFP_KERNEL, node); if (!entry) return -ENOMEM; -- 1.9.1