[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171215073151.y5nme76arcg7ra23@hirez.programming.kicks-ass.net>
Date: Fri, 15 Dec 2017 08:31:51 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: "jianchao.wang" <jianchao.w.wang@...cle.com>
Cc: Bart Van Assche <Bart.VanAssche@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"kernel-team@...com" <kernel-team@...com>,
"oleg@...hat.com" <oleg@...hat.com>, "hch@....de" <hch@....de>,
"axboe@...nel.dk" <axboe@...nel.dk>,
"osandov@...com" <osandov@...com>, "tj@...nel.org" <tj@...nel.org>
Subject: Re: [PATCH 2/6] blk-mq: replace timeout synchronization with a RCU
and generation based scheme
On Fri, Dec 15, 2017 at 10:12:50AM +0800, jianchao.wang wrote:
> > That only makes it a little better:
> >
> > Task-A Worker
> >
> > write_seqcount_begin()
> > blk_mq_rw_update_state(rq, IN_FLIGHT)
> > blk_add_timer(rq)
> > <timer>
> > schedule_work()
> > </timer>
> > <context-switch to worker>
> > read_seqcount_begin()
> > while(seq & 1)
> > cpu_relax();
> >
> Hi Peter
>
> The current seqcount read side is as below:
> do {
> start = read_seqcount_begin(&rq->gstate_seq);
static inline unsigned read_seqcount_begin(const seqcount_t *s)
{
seqcount_lockdep_reader_access(s);
return raw_read_seqcount_begin(s);
}
static inline unsigned raw_read_seqcount_begin(const seqcount_t *s)
{
unsigned ret = __read_seqcount_begin(s);
smp_rmb();
return ret;
}
static inline unsigned __read_seqcount_begin(const seqcount_t *s)
{
unsigned ret;
repeat:
ret = READ_ONCE(s->sequence);
if (unlikely(ret & 1)) {
cpu_relax();
goto repeat;
}
return ret;
}
Powered by blists - more mailing lists