From: Oleg Nesterov <oleg@redhat.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org,
peterz@infradead.org
Subject: Re: [PATCH 0/5][v3] rq-qos memory barrier shenanigans
Date: Thu, 18 Jul 2019 17:56:28 +0200 [thread overview]
Message-ID: <20190718155628.GC13355@redhat.com> (raw)
In-Reply-To: <20190716201929.79142-1-josef@toxicpanda.com>
On 07/16, Josef Bacik wrote:
>
> - add a comment about why we don't need a mb for the first data.token check
> which I'm sure Oleg will tell me is wrong and I'll have to send a v4
we don't need it because prepare_to_wait_exclusive() does set_current_state()
and this implies mb().
(in fact I think in this particular case it is not needed at all because
rq_qos_wake_function() sets condition == T under wq_head->lock)
I see nothing wrong in this series. Feel free to add
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
But why does it use wq_has_sleeper() ? I do not understand why do we need
mb() before waitqueue_active() in this particular case...
and just for record. iiuc acquire_inflight_cb() can't block, so it is not
clear to me why performance-wise this all is actually better than just
void rq_qos_wait(struct rq_wait *rqw, void *private_data,
acquire_inflight_cb_t *acquire_inflight_cb)
{
struct rq_qos_wait_data data = {
.wq = {
.flags = WQ_FLAG_EXCLUSIVE;
.func = rq_qos_wake_function,
.entry = LIST_HEAD_INIT(data.wq.entry),
},
.task = current,
.rqw = rqw,
.cb = acquire_inflight_cb,
.private_data = private_data,
};
if (!wq_has_sleeper(&rqw->wait) && acquire_inflight_cb(rqw, private_data))
return;
spin_lock_irq(&rqw->wait.lock);
if (list_empty(&wq_entry->entry) && acquire_inflight_cb(rqw, private_data))
data.got_token = true;
else
__add_wait_queue_entry_tail(&rqw->wait, &data.wq);
spin_unlock_irq(&rqw->wait.lock);
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
if (data.got_token)
break;
io_schedule();
}
finish_wait(&rqw->wait, &data.wq);
}
note also that the acquire_inflight_cb argument goes away.
Nevermind, feel free to ignore.
Oleg.
next prev parent reply other threads:[~2019-07-18 15:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 20:19 [PATCH 0/5][v3] rq-qos memory barrier shenanigans Josef Bacik
2019-07-16 20:19 ` [PATCH 1/5] wait: add wq_has_single_sleeper helper Josef Bacik
2019-07-16 20:19 ` [PATCH 2/5] rq-qos: fix missed wake-ups in rq_qos_throttle Josef Bacik
2019-07-16 20:19 ` [PATCH 3/5] rq-qos: don't reset has_sleepers on spurious wakeups Josef Bacik
2019-07-16 20:19 ` [PATCH 4/5] rq-qos: set ourself TASK_UNINTERRUPTIBLE after we schedule Josef Bacik
2019-07-16 20:19 ` [PATCH 5/5] rq-qos: use a mb for got_token Josef Bacik
2019-07-18 15:56 ` Oleg Nesterov [this message]
2019-07-18 16:20 ` [PATCH 0/5][v3] rq-qos memory barrier shenanigans Jens Axboe
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=20190718155628.GC13355@redhat.com \
--to=oleg@redhat.com \
--cc=axboe@kernel.dk \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.