Received: by 10.213.65.68 with SMTP id h4csp3897105imn; Tue, 10 Apr 2018 06:22:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+847hGZyeDlS7qFyEAAhz1MBDt4KuPWDclgMrR8/pUGRnEmvNbvM6mYdhc6jHZQBUxre/U X-Received: by 10.98.245.156 with SMTP id b28mr365643pfm.90.1523366558284; Tue, 10 Apr 2018 06:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523366558; cv=none; d=google.com; s=arc-20160816; b=ognDF3hBuzMErFcEDNqYqf616hZR+Py6wKDDTdm6YPvDP8erPieXTQuTh/lq3i5up3 /YwcNpVC9WR9T23XEtgaMwGsLUsY4+ie/kIbFbevsP/yEmXHdcEbUN0u0hE1ly2cmRUz bGWC+ZKS6RF9bMBtFVFcGHm+EcX+erLgI8IMkY6i+Djwunlt3W2NHmTVrSbV6zOwmc4B +L3dnRc4p8rc88CaWuInFYmBmwHudoJFBabJ5zJCK7wYvVKJfp+cb9HFnMoUb+gW+1hu fJ94UnEMj8xb0a7QgfSYYMuxSTydXpGAaXsfCJ9iRKIcFtqIImJiFjZ5uAMBman4RJEm 0zoQ== 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=ZiWorbxJCN9BdXxve2oETlVqe6I9cI1BlllepHxLnMQ=; b=GrjtqeSX3BzvjFla3/uCCCN2yTKd/sHopBIM8xNdA88MKMLTvrNlAGQT8vpP+pSDMK T3c1xEaVL/LQ0MO+kizpSHUSPvdQTLyM6tiwvilX7/N5YERKIUTz1vXoWqdhFm7I9e6s hOaLN2i/mjT/X80vY5C1k3tBy91tFaWp5dn93tlK7z0Nbmg6nZ3QjnGs4DmkKaeSn2Gv oFzzuemIR6ZcF5skQTE7U4MyWNYnShTN0iHvJhGYhjbMghdR0Bpt8BZa0hsSUujN0fou z7rns1PtKe4TYlyHV9puhcO6LclrndvkSxVOx46mFEPDULRg8rta5bEH6TvEhZtfj4q3 dUag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=L27+aigk; 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 a190si1831201pge.436.2018.04.10.06.22.01; Tue, 10 Apr 2018 06:22:38 -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=L27+aigk; 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 S1753413AbeDJNSM (ORCPT + 99 others); Tue, 10 Apr 2018 09:18:12 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:42366 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752936AbeDJNSK (ORCPT ); Tue, 10 Apr 2018 09:18:10 -0400 Received: by mail-pl0-f65.google.com with SMTP id t20-v6so4656177ply.9 for ; Tue, 10 Apr 2018 06:18:10 -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=ZiWorbxJCN9BdXxve2oETlVqe6I9cI1BlllepHxLnMQ=; b=L27+aigkoVd6ylLrnRJLBkrTfDM81ZDfpcK8uF1PgD1A9NN6svgXQjjIDKchJ93t0L Kr7bMOYRw+Rq4U4JWk3oU7O8BEx25oV1MGq0ySXZAY4+2HN1Wcol6JjW2qRWlrBWyP8B 6O8JpYILjTzX1pqt3Mvl+t/lG+Fa5zRr+/QxIdd3JDmcd9w9C5p8D2s1zuMW8nrxRsJF YwmXkBdnPuRAKsyE0lIe6J7hdDp7JXLmGVhBgGwp4fjtpSec+e5Te2tQisGz8yDYBjVp jGrtiZ+Q2D64VfHCyBy0ss3aG9gx703nEIJijujM8hLpx3HaQE1JSVPfdDa8URjp4Qzb 5GOA== 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=ZiWorbxJCN9BdXxve2oETlVqe6I9cI1BlllepHxLnMQ=; b=rE2XYV6hb8PXmlz3fcivue8lKU68aPbYySlTa23jwFpahIoDa3atBUAau6oi9114W9 wj+izXlwJM42BaXWa86nPfHc3hRlkoIT4MuoZYWax+PTtxXlDz0wj/oIGZOBfttdhi4v 0EjYKYQ2lBjt44YVE8fabPNcB4tl6QJXNYjVgHrYr3z7ZH4pbn7ydhah1WFhS49PNEMi m4sMfqgXlogj3LNVVbLXnafl+4YydtViiokvyiPiwzISK0+v67kK1ktNqgIgl45fzNRt nmqYypzPKYpiBg/D/m6zkDntXazPThfzc0Dc6CYxXT3qI3e5dQ2g83yXF1WMzrU2QD9/ 4HPg== X-Gm-Message-State: ALQs6tCmcz2dKNdVG1s9Ifzsq3U0r/PoBTSuY88WIh5zMKQfSKvkle+u AuivXX0oyD4UFoi3s70P4xA= X-Received: by 2002:a17:902:8f94:: with SMTP id z20-v6mr431734plo.174.1523366290449; Tue, 10 Apr 2018 06:18:10 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id u13sm6978026pfd.112.2018.04.10.06.18.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 06:18:10 -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 2/2] ntb: ntb_transport: Replace GFP_ATOMIC with GFP_KERNEL in ntb_transport_create_queue Date: Tue, 10 Apr 2018 21:17:54 +0800 Message-Id: <1523366274-31737-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_create_queue() is never called in atomic context. ntb_transport_create_queue() is only called by ntb_netdev_probe(), which is set as ".probe" in struct ntb_transport_client. Despite never getting called from atomic context, ntb_transport_create_queue() 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index f58d8e3..2c0c8bc 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c @@ -1825,7 +1825,7 @@ struct ntb_transport_qp * qp->rx_dma_chan ? "DMA" : "CPU"); for (i = 0; i < NTB_QP_DEF_NUM_ENTRIES; i++) { - entry = kzalloc_node(sizeof(*entry), GFP_ATOMIC, node); + entry = kzalloc_node(sizeof(*entry), GFP_KERNEL, node); if (!entry) goto err1; @@ -1836,7 +1836,7 @@ struct ntb_transport_qp * qp->rx_alloc_entry = NTB_QP_DEF_NUM_ENTRIES; for (i = 0; i < qp->tx_max_entry; i++) { - entry = kzalloc_node(sizeof(*entry), GFP_ATOMIC, node); + entry = kzalloc_node(sizeof(*entry), GFP_KERNEL, node); if (!entry) goto err2; -- 1.9.1