From: Michal Hocko <mhocko@kernel.org>
To: NeilBrown <neilb@suse.com>
Cc: Jens Axboe <axboe@fb.com>,
linux-block@vger.kernel.org, linux-mm@kvack.org,
LKML <linux-kernel@vger.kernel.org>,
Ming Lei <tom.leiming@gmail.com>
Subject: Re: [PATCH v2] loop: Add PF_LESS_THROTTLE to block/loop device thread.
Date: Thu, 6 Apr 2017 08:53:27 +0200 [thread overview]
Message-ID: <20170406065326.GB5497@dhcp22.suse.cz> (raw)
In-Reply-To: <878tnegtoo.fsf@notabene.neil.brown.name>
On Thu 06-04-17 12:23:51, NeilBrown wrote:
[...]
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 0ecb6461ed81..95679d988725 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -847,10 +847,12 @@ static void loop_unprepare_queue(struct loop_device *lo)
> static int loop_prepare_queue(struct loop_device *lo)
> {
> kthread_init_worker(&lo->worker);
> - lo->worker_task = kthread_run(kthread_worker_fn,
> + lo->worker_task = kthread_create(kthread_worker_fn,
> &lo->worker, "loop%d", lo->lo_number);
> if (IS_ERR(lo->worker_task))
> return -ENOMEM;
> + lo->worker_task->flags |= PF_LESS_THROTTLE;
> + wake_up_process(lo->worker_task);
> set_user_nice(lo->worker_task, MIN_NICE);
> return 0;
This should work for the current implementation because kthread_create
will return only after the full initialization has been done. No idea
whether we can rely on that in future. I also think it would be cleaner
to set the flag on current and keep the current semantic that only
current changes its flags.
So while I do not have a strong opinion on this I think defining loop
specific thread function which set PF_LESS_THROTTLE as the first thing
is more elegant and less error prone longerm. A short comment explaining
why we use the flag there would be also preferred.
I will leave the decision to you.
Thanks.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2017-04-06 6:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 1:18 [PATCH] loop: Add PF_LESS_THROTTLE to block/loop device thread NeilBrown
2017-04-04 7:10 ` Christoph Hellwig
2017-04-05 4:27 ` NeilBrown
2017-04-05 5:13 ` Ming Lei
2017-04-04 11:23 ` Michal Hocko
2017-04-04 14:24 ` Ming Lei
2017-04-05 4:31 ` NeilBrown
2017-04-05 4:33 ` [PATCH v2] " NeilBrown
2017-04-05 5:05 ` Ming Lei
2017-04-05 7:19 ` Michal Hocko
2017-04-05 7:32 ` Michal Hocko
2017-04-06 2:23 ` NeilBrown
2017-04-06 6:53 ` Michal Hocko [this message]
2017-04-06 23:47 ` [PATCH v3] " NeilBrown
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=20170406065326.GB5497@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=axboe@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=neilb@suse.com \
--cc=tom.leiming@gmail.com \
/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).