lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/8] RCU, workqueue: Implement rcu_work
Hello, Lai.

On Fri, Mar 16, 2018 at 02:01:35PM +0800, Lai Jiangshan wrote:
> > +bool flush_rcu_work(struct rcu_work *rwork)
> > +{
> > + if (test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&rwork->work))) {
> > + rcu_barrier();
> > + flush_work(&rwork->work);
> > + return true;
>
> A possible tiny improvement: check if it was already queued on wq.
> For example:
>
> if (test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&rwork->work))) {
> if (!flush_work(&rwork->work)) {
> rcu_barrier();
> flush_work(&rwork->work);
> }
> return true;

But this breaks the guarantee that flush_work waits for the latest
queueing instance. Please consider the following scenario.


1. rcu-work is queued
2. rcu-work starts executing
3. rcu-work is queued again
4. rcu-work is flushed
5. execution finishes
6. flush finishes
7. execution finishes

6 should happen after 7 but it didn't.

Thanks.

--
tejun

\
 
 \ /
  Last update: 2018-03-19 17:46    [W:3.096 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site