mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: "Javier González" <javier@javigon.com>
Cc: Matias Bjorling <mb@lightnvm.io>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	kbuild-all@01.org
Subject: [PATCH] pblk: fix call_kern.cocci warnings
Date: Fri, 26 Feb 2016 21:57:17 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1602262153260.2055@localhost6.localdomain6> (raw)

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 <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---

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(-)

--- 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);

                 reply	other threads:[~2016-02-26 20:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1602262153260.2055@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=javier@javigon.com \
    --cc=kbuild-all@01.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mb@lightnvm.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®