From: Oleg Nesterov <oleg@tv-sign.ru>
To: Christoph Lameter <christoph@lameter.com>
Cc: linux-kernel@vger.kernel.org, Shai Fultheim <Shai@Scalex86.org>,
Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 0/2] del_timer_sync: proof of concept
Date: Tue, 15 Mar 2005 20:19:39 +0300 [thread overview]
Message-ID: <4237192B.7E8AA85A@tv-sign.ru> (raw)
In-Reply-To: <Pine.LNX.4.58.0503111254270.25992@server.graphe.net>
Andrew Morton wrote:
>
> If we're prepared to rule that a timer handler is not allowed to do
> add_timer_on() then a recurring timer is permanently pinned to a CPU, isn't
> it?
>
> That should make things simpler?
In that case I think that both problems (race and scalability)
can be solved without increasing sizeof(timer_list).
What if timer_list had ->pending field? Then we can do:
timer_pending:
return timer->pending;
__mod_timer:
internal_add_timer(new_base, timer);
timer->base = new_base;
timer->pending = 1;
__run_timers:
list_del(&timer->entry);
set_running_timer(base, timer);
/* do not change timer->base */
timer->pending = 0;
spin_unlock(base->lock);
timer->function();
del_timer:
if (!timer->pending)
return 0;
base = timer->base;
...
del_timer_sync:
base = timer->base;
if (!base)
return 0;
spin_lock(base->lock);
if (base != timer->base)
goto del_again;
if (base->running_timer == timer)
goto del_again;
if (timer->pending)
list_del(&timer->entry);
timer->pending = 0;
timer->base = NULL;
The ->pending flag could live in the least significant bit of
timer->base, this way we:
1. do not waste the space
2. can read/write base+pending atomically
These patches are incomplete/suboptimal, just a proof of concept.
Oleg.
next prev parent reply other threads:[~2005-03-15 16:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-11 18:54 [patch] del_timer_sync scalability patch Oleg Nesterov
2005-03-11 20:57 ` Christoph Lameter
2005-03-15 17:19 ` Oleg Nesterov [this message]
2005-03-15 18:15 ` [PATCH 0/2] del_timer_sync: proof of concept Christoph Lameter
2005-03-15 19:41 ` Oleg Nesterov
2005-03-15 19:02 ` Christoph Lameter
2005-03-16 16:55 ` Oleg Nesterov
2005-03-15 17:19 ` [PATCH 1/2] " Oleg Nesterov
2005-03-15 17:20 ` [PATCH 2/2] " Oleg Nesterov
2005-03-16 9:00 ` Ingo Molnar
2005-03-16 12:09 ` Oleg Nesterov
2005-03-16 13:52 ` Ingo Molnar
2005-03-13 13:13 ` [patch] del_timer_sync scalability patch Oleg Nesterov
2005-03-14 19:40 ` Christoph Lameter
2005-03-15 9:12 ` Oleg Nesterov
2005-03-15 8:06 ` Christoph Lameter
2005-03-15 9:28 ` Ingo Molnar
2005-03-15 10:28 ` 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=4237192B.7E8AA85A@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=Shai@Scalex86.org \
--cc=akpm@osdl.org \
--cc=christoph@lameter.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
Powered by JetHome