From: Peter Zijlstra <peterz@infradead.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] workqueue: not allow recursion run_workqueue
Date: Thu, 22 Jan 2009 10:52:45 +0100 [thread overview]
Message-ID: <1232617965.4890.110.camel@laptop> (raw)
In-Reply-To: <49780C3A.1050601@cn.fujitsu.com>
On Thu, 2009-01-22 at 14:03 +0800, Lai Jiangshan wrote:
>
> void do_some_cleanup(void)
> {
> find_all_queued_work_struct_and_mark_it_old();
> flush_workqueue(workqueue);
> /* we can destroy old work_struct for we have flushed them */
> destroy_old_work_structs();
> }
>
> if work->func() called do_some_cleanup(), it's very probably a bug.
Of course it is, if only because calling flush on the same workqueue is
pretty dumb.
But I'm still not getting it, flush_workqueue() provides the guarantee
that all work enqueued previous to the call will be finished thereafter.
The self-flush stuff you propose to rip out doesn't violate that
guarantee afaict.
Suppose we have a workqueue Q, with pending work W1..Wn.
Suppose W5 will have the nested flush, it will then recursively complete
W6..Wn+i, where i accounts for any concurrent worklet additions.
Therefore it will have completed (at least) those worklets that were
enqueued at the time flush got called.
So, to get back at your changelog.
1) yes lockdep will complain -- for good reasons, and I'm all for
getting rid of this mis-feature.
2) I've no clue what you're on about
3) more mystery.
prev parent reply other threads:[~2009-01-22 9:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 9:42 [PATCH] workqueue: not allow recursion run_workqueue Lai Jiangshan
2009-01-21 10:56 ` Ingo Molnar
2009-01-21 11:12 ` Peter Zijlstra
2009-01-21 12:45 ` Oleg Nesterov
2009-01-22 6:03 ` Lai Jiangshan
2009-01-22 9:52 ` Peter Zijlstra [this message]
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=1232617965.4890.110.camel@laptop \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@tv-sign.ru \
/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