public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Ingo Molnar <mingo@elte.hu>
Cc: Christoph Lameter <christoph@lameter.com>,
	linux-kernel@vger.kernel.org, Shai Fultheim <Shai@Scalex86.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH 2/2] del_timer_sync: proof of concept
Date: Wed, 16 Mar 2005 15:09:29 +0300	[thread overview]
Message-ID: <423821F9.19FD92C8@tv-sign.ru> (raw)
In-Reply-To: 20050316090024.GB11582@elte.hu

Ingo Molnar wrote:
>
> * Oleg Nesterov <oleg@tv-sign.ru> wrote:
>
> > New rules:
> > 	->_base &  1	: is timer pending
> > 	->_base & ~1	: timer's base
>
> how would it look like if we had a separate timer->pending field after
> all? Would it be faster/cleaner?

The only change visible outside kernel/timer.c is:

 static inline int timer_pending(const struct timer_list * timer)
 {
-	return timer->base != NULL;
+	return timer->base & 1;
 }

Currently __get_base() usage in the kernel/time.c suboptimal and
should be cleanuped, I see no other problems with performance.

> (we dont need to keep them small _that_ bad - if there's a good reason
> we should rather add a clean new field than to encode two fields into
> one field and complicate the code.)

I think that separate timer->pending field will require more changes,
because we can't read/write base+pending atomically.

int del_timer()
{
again:
	if (!timer->pending)	// not strictly necessary, but it is
		return 0;	// nice to avoid locking
	base = timer->base;
	if (!base)
		return 0;

	spin_lock(base->lock);

	if (!timer->pending) {
		spin_unlock();
		goto again;
	}
	if (timer->base != base) {
		spin_unlock();
		goto again;
	}
	....	
}

Note also, that we have to audit every timer->base usage anyway,
because currently it mix base and pending.

But may be you are right, the encoding of a bit in a pointer is
indeed weird.

Oleg.

  reply	other threads:[~2005-03-16 11:04 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   ` [PATCH 0/2] del_timer_sync: proof of concept Oleg Nesterov
2005-03-15 18:15     ` 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 [this message]
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=423821F9.19FD92C8@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