Received: by 10.192.165.156 with SMTP id m28csp194201imm; Tue, 10 Apr 2018 19:38:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+3ryGtQxugdv7alO3ViTr5kTbvkn8BU0xe7xTBgYRp6M1RJqzdWOj8k2AS9PRJ7F5xNwiH X-Received: by 10.98.71.211 with SMTP id p80mr2380574pfi.136.1523414335249; Tue, 10 Apr 2018 19:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523414335; cv=none; d=google.com; s=arc-20160816; b=ZFyWFWEbi5TUyQsW4d2KqPHYg8Fim1NOF+sCl+/nv/qldiDvlmqT2CMgdGTUZmVw1F Bs9wSUL1WNcLURSMJ56ZxeWC2eFP5AUBivLE4wCtk+mPNC/5qry6FloxW6O3CVS6Bd8B uND0iR2B3k3gBsQ7iW4JQDf7zyZrzVqXM6viy0uk5Cy5jAdf0A4kD9mbWG/ED+cxEmiS mQbjIY0x54JAsxP4ydkrCx2YIcshvxerQXzR8ht4Ubg/y3nTL01HibaMdgI6HmmpZcsI w7VPjSxIM9LjA9C7JFK+zDPgH6LSQEySzQreW/GVGxR5c5kQllqAtJIWqBLCgnSPSfQN 0a7A== 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=3mMJ5zfZLlTZIeXtv5J21PPn/M7sivkGuYYmtdC0jZc=; b=WrLQS5+rsTx7h6+uPvkKGuSq7L+OjA96vseBwiGYX3H6mUhT15SZqs7GToujbDeg1g um20qHT2srfGqgZRMv3anxmxvQolqt90qT3niXMdzrjpyfzHs2K2O3QdB4IkqLyoVxnv spCdt65X40t5WAhoWzvPk/xGOHE35RLtZdGaThp6vKJSRUWy4SUzi1vMjKugHGWAV5ej AYHkcleCh6O9EuvCqs8TJqfrehP6h0aUFlXCa0LOu/9MEDyqb61nHIfpKjh4fUJnyF8U 8TOCPHkKDXc2TqZ055lAW1tA9gmuB/aWOiM6jNneodiKYfkQFX6D1+P+65Wk3trFMhMp Lt9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=O1NN4TpP; 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 s12si69780pgq.766.2018.04.10.19.38.06; Tue, 10 Apr 2018 19:38:55 -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=O1NN4TpP; 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 S1752623AbeDKCes (ORCPT + 99 others); Tue, 10 Apr 2018 22:34:48 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:38235 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752016AbeDKCeq (ORCPT ); Tue, 10 Apr 2018 22:34:46 -0400 Received: by mail-pl0-f67.google.com with SMTP id c7-v6so266900plr.5; Tue, 10 Apr 2018 19:34: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=3mMJ5zfZLlTZIeXtv5J21PPn/M7sivkGuYYmtdC0jZc=; b=O1NN4TpPdcaAFt3uMiv/zZzFzUZ2Uret5RNexykT5vxPIk2/i57HvAyprvkqdpiQC4 WAEsURiiYTHD4i/W5NeJ20adY27jmC2fvOHM0v9RsfeyPPf3kAgUrNAWPEDflL8CbcoX F5cxAIri9pcatQFylJ2STwCcz11FsBVNZrV8hq4odVvu2hXBi0oYg2FPwFrzEb00ymnR q5PlVa5QngOTpm9vEiOUK0l6B8FawYu59gkQeviKM70cll5DWLoDWuO6EdYRaerKI9zQ /hBsr9iRVf2n+alHff4DhOc2NOkfgH+1ceG+ZKfpETKyLyFc8GeY4g51LnaaDtG3gzle pMwQ== 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=3mMJ5zfZLlTZIeXtv5J21PPn/M7sivkGuYYmtdC0jZc=; b=L/EkOEeYRUcf03YtBjBtNVvFOG6hjE9R9RWiFOv4YWXn/Sqm04gSEJj6r/JMTfHjxT 6mDlh6UwMkbS/SPCtrQmUtw7TiX6JdQuMuGmLbZoairqg/CxYQZ2Rdg4hqlrveuHjg++ h9joMCi1Sa2649VwvoAspzBB2mquz//4uNPEqNCDQNq7802UNqRoALOGsGbMrvm2kwEc JPOlw/tUWpVUCekjKdlYOD58GX+BvMo+OwJQv0eMayqrlQyDQyLl80DZUwB7NJPQ6cwi 5KYdIILmNmtvCSNf6llUDtsjbLQk81Rz0lRhmNXPTjilhhQROk3tLcTWGA2i8Kvg3pKr VtVA== X-Gm-Message-State: ALQs6tAXqPMMrx7YnJWSUBgn9D0xTm4EUR08VEQLM59KKSyeoVpNyqTX KtnInTRVk9JDIaA5x2ITkM2weT6i X-Received: by 2002:a17:902:5a4:: with SMTP id f33-v6mr3057487plf.278.1523414086541; Tue, 10 Apr 2018 19:34:46 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id k73sm116800pgc.55.2018.04.10.19.34.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 19:34:46 -0700 (PDT) From: Jia-Ju Bai To: asun@darksunrising.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: sun: cassini: Replace GFP_ATOMIC with GFP_KERNEL in cas_check_invariants Date: Wed, 11 Apr 2018 10:34:39 +0800 Message-Id: <1523414079-2452-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 cas_check_invariants() is never called in atomic context. cas_check_invariants() is only called by cas_init_one(), which is only set as ".probe" in struct pci_driver. Despite never getting called from atomic context, cas_check_invariants() calls alloc_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 --- drivers/net/ethernet/sun/cassini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c index 382993c..4dd38e3 100644 --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c @@ -3412,7 +3412,7 @@ static int cas_check_invariants(struct cas *cp) #ifdef USE_PAGE_ORDER if (PAGE_SHIFT < CAS_JUMBO_PAGE_SHIFT) { /* see if we can allocate larger pages */ - struct page *page = alloc_pages(GFP_ATOMIC, + struct page *page = alloc_pages(GFP_KERNEL, CAS_JUMBO_PAGE_SHIFT - PAGE_SHIFT); if (page) { -- 1.9.1