mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jarek Poplawski <jarkao2@o2.pl>,
	Max Krasnyansky <maxk@qualcomm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] workqueues: implement flush_work()
Date: Sat, 14 Jun 2008 11:13:40 +0200	[thread overview]
Message-ID: <20080614091339.GA2466@ami.dom.local> (raw)
In-Reply-To: <20080613142801.GA9165@tv-sign.ru>

On Fri, Jun 13, 2008 at 06:28:01PM +0400, Oleg Nesterov wrote:
> (on top of [PATCH] workqueues: insert_work: use "list_head *" instead of "int tail"
>  http://marc.info/?l=linux-kernel&m=121328944230175)
> 
> Most of users of flush_workqueue() can be changed to use cancel_work_sync(),
> but sometimes we really need to wait for the completion and cancelling is not
> an option. schedule_on_each_cpu() is good example.
> 
> Add the new helper, flush_work(work), which waits for the completion of the
> specific work_struct.

This all looks right and better than current flush_, but... the main
problem is that probably in 90% cases cancel_ + self-running a work
function (if cancelled) should be both more efficient and safer wrt
locking (what you convince me to, BTW). But, since there is no visible
macro/wrapper for this, people will probably mostly choose what they
can see in workqueue.h, so not necessarily the best thing.

Another question is if schedule_on_each_cpu() is really such a good
example here: it seems these "xxx && yyy" examples could be faster,
but I've lost track of this earlier thread.

BTW, flush_work() probably needs a lockdep annotation similar to
flush_workqueue().

Otherwise this all looks OK to me.

Thanks,
Jarek P.

  parent reply	other threads:[~2008-06-14  9:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-13 14:28 Oleg Nesterov
2008-06-13 14:46 ` Oleg Nesterov
2008-06-14  9:13 ` Jarek Poplawski [this message]
2008-06-14 13:59   ` Oleg Nesterov
2008-06-14 18:51     ` Jarek Poplawski
2008-06-15 10:22       ` Oleg Nesterov

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=20080614091339.GA2466@ami.dom.local \
    --to=jarkao2@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jarkao2@o2.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxk@qualcomm.com \
    --cc=oleg@tv-sign.ru \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®