From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: [PATCH] block: ioprio: Replace GFP_ATOMIC with GFP_KERNEL in set_task_ioprio()
Date: Mon, 23 Jul 2018 10:21:16 +0800 [thread overview]
Message-ID: <20180723022116.6919-1-baijiaju1990@gmail.com> (raw)
set_task_ioprio() is only called by SYSCALL_DEFINE3(), ext4_fill_super(),
ext4_remount() and reada_start_machine_worker().
And these functions are not called in atomic context.
set_task_ioprio() calls get_task_io_context with GFP_ATOMIC, which is
unnecessary. GFP_ATOMIC can be replaced with GFP_KERNEL.
This is found by a static analysis tool named DCNS written by myself.
I also manually check the kernel code before reporting it.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
block/ioprio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/ioprio.c b/block/ioprio.c
index 6f5d0b6625e3..42d91ee7080f 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -51,7 +51,7 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
if (err)
return err;
- ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE);
+ ioc = get_task_io_context(task, GFP_KERNEL, NUMA_NO_NODE);
if (ioc) {
ioc->ioprio = ioprio;
put_io_context(ioc);
--
2.17.0
next reply other threads:[~2018-07-23 2:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-23 2:21 Jia-Ju Bai [this message]
2018-07-23 7:18 ` [PATCH] block: ioprio: Replace GFP_ATOMIC with GFP_KERNEL in set_task_ioprio() Christoph Hellwig
2018-07-23 12:59 ` Jia-Ju Bai
2018-07-23 21:49 ` Tetsuo Handa
2018-07-24 1:42 ` Jia-Ju Bai
2018-07-24 7:47 ` [LKP] [block] 8448e82606: WARNING:suspicious_RCU_usage kernel test robot
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=20180723022116.6919-1-baijiaju1990@gmail.com \
--to=baijiaju1990@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).