From patchwork Fri Feb 26 20:57:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 8441781 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC1329F314 for ; Fri, 26 Feb 2016 20:57:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 314DD203B5 for ; Fri, 26 Feb 2016 20:57:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F17B7203AD for ; Fri, 26 Feb 2016 20:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755035AbcBZU5W (ORCPT ); Fri, 26 Feb 2016 15:57:22 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:28998 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754972AbcBZU5V (ORCPT ); Fri, 26 Feb 2016 15:57:21 -0500 X-IronPort-AV: E=Sophos;i="5.22,505,1449529200"; d="scan'208";a="166129978" Received: from 198.67.28.109.rev.sfr.net (HELO hadrien) ([109.28.67.198]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Feb 2016 21:57:19 +0100 Date: Fri, 26 Feb 2016 21:57:17 +0100 (CET) From: Julia Lawall X-X-Sender: jll@localhost6.localdomain6 To: =?ISO-8859-15?Q?Javier_Gonz=E1lez?= cc: Matias Bjorling , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, kbuild-all@01.org Subject: [PATCH] pblk: fix call_kern.cocci warnings Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert GFP_KERNEL to GFP_ATOMIC in a function that may be called with locks held. See the call site on line 751, and the call to spin_lock on line 744. Generated by: scripts/coccinelle/locks/call_kern.cocci Signed-off-by: Fengguang Wu Signed-off-by: Julia Lawall --- Perhaps there is a way to reorganize the code such that pblk_get_blk is not called under the lock. tree: https://github.com/OpenChannelSSD/linux.git pblk head: 01eab75e8310ada5c5d387ee0d77c9051f2ba238 commit: 8e755964c7e8b0266a95fb90557823dacf9da12f [11/21] pblk: do not use mempool for write buffer allocation pblk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/lightnvm/pblk.c +++ b/drivers/lightnvm/pblk.c @@ -282,14 +282,14 @@ static struct pblk_block *pblk_get_blk(s void *data; int nentries = dev->sec_per_blk; - data = kmalloc(dev->sec_per_blk * dev->sec_size, GFP_KERNEL); + data = kmalloc(dev->sec_per_blk * dev->sec_size, GFP_ATOMIC); if (!data) { pr_err("nvm: pblk: cannot allocate write buffer for block\n"); return NULL; } entries = kmalloc(dev->sec_per_blk * sizeof(struct buf_entry), - GFP_KERNEL); + GFP_ATOMIC); if (!entries) { pr_err("nvm: pblk: cannot allocate write buffer for block\n"); kfree(data); @@ -297,7 +297,7 @@ static struct pblk_block *pblk_get_blk(s } sync_bitmap = kmalloc(BITS_TO_LONGS(nentries) * sizeof(unsigned long), - GFP_KERNEL); + GFP_ATOMIC); if (!sync_bitmap) { kfree(data); kfree(entries);