[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070507103107.GD1754@ff.dom.local>
Date: Mon, 7 May 2007 12:31:08 +0200
From: Jarek Poplawski <jarkao2@...pl>
To: Oleg Nesterov <oleg@...sign.ru>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
David Chinner <dgc@....com>,
David Howells <dhowells@...hat.com>,
Gautham Shenoy <ego@...ibm.com>, Ingo Molnar <mingo@...e.hu>,
Srivatsa Vaddagiri <vatsa@...ibm.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] make-cancel_rearming_delayed_work-reliable-fix
On Sun, May 06, 2007 at 01:32:13AM +0400, Oleg Nesterov wrote:
> on top of
> make-cancel_rearming_delayed_work-reliable-spelling.patch
>
> Add cpu-relax() into spinloops, and a comments update.
>
> Small note. The new implementation has another downside. Suppose that rearming
> work->func() gets a preemtion after setting WORK_STRUCT_PENDING but before
> add_timer/__queue_work. In that case cancel_rearming_delayed_work() will burn
> CPU in a busy-wait loop. Fortunately this can happen only with CONFIG_PREEMPT
> and we spin with preemption enabled.
>
> We can avoid this,
>
> void cancel_rearming_delayed_work(struct delayed_work *dwork)
> {
> int retry;
>
> do {
> retry = !del_timer(&dwork->timer) &&
> !try_to_grab_pending(&dwork->work);
> wait_on_work(&dwork->work);
> } while (retry);
>
> work_clear_pending(&dwork->work);
> }
>
> but I don't think this is worth fixing.
I think so.
There is a lot of new things in the final version of this
patch. I guess, there was no such problem in the previous
version.
I can also see you have new doubts about usefulness, which
I cannot understand:
- even if there are some slowdowns, where does it matter?
- the "old" method uses only one method of cancelling, i.e.
del_timer, not trying to stop requeuing or to remove from
the queue; it seems to be effective only with long delayed
timers, and its real problems are probably mostly invisible.
BTW, I'm still not convinced all additions are needed:
the "old" cancel_rearming_ doesn't care about checking
or waiting on anything after del_timer positive.
Regards,
Jarek P.
PS: I'll try to check this all in the evening and will
write tomorrow, if found something interesting.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists