On 12/15/2017 03:31 PM, Peter Zijlstra wrote: > 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; > } > Really thanks for kindly pointing out. jianchao
- Re: [PATCH 2/6] blk-mq: replace timeout synchronizati... Bart Van Assche
- Re: [PATCH 2/6] blk-mq: replace timeout synchroni... t...@kernel.org
- Re: [PATCH 2/6] blk-mq: replace timeout synch... Bart Van Assche
- Re: [PATCH 2/6] blk-mq: replace timeout s... t...@kernel.org
- Re: [PATCH 2/6] blk-mq: replace timeout synchroni... Peter Zijlstra
- Re: [PATCH 2/6] blk-mq: replace timeout synch... Bart Van Assche
- Re: [PATCH 2/6] blk-mq: replace timeout s... Peter Zijlstra
- Re: [PATCH 2/6] blk-mq: replace time... jianchao.wang
- Re: [PATCH 2/6] blk-mq: replace ... Peter Zijlstra
- Re: [PATCH 2/6] blk-mq: replace ... jianchao.wang
- Re: [PATCH 2/6] blk-mq: replace time... Mike Galbraith
- Re: [PATCH 2/6] blk-mq: replace timeout synch... t...@kernel.org
- [PATCH 3/6] blk-mq: use blk_mq_rq_state() instead of testi... Tejun Heo
- [PATCH 1/6] blk-mq: protect completion path with RCU Tejun Heo
- Re: [PATCH 1/6] blk-mq: protect completion path with ... jianchao.wang
- Re: [PATCH 1/6] blk-mq: protect completion path w... Tejun Heo
- Re: [PATCH 1/6] blk-mq: protect completion pa... jianchao.wang
- Re: [PATCH 1/6] blk-mq: protect completion path with ... Bart Van Assche
- Re: [PATCH 1/6] blk-mq: protect completion path w... t...@kernel.org
- Re: [PATCHSET v2] blk-mq: reimplement timeout handling Jens Axboe