From: john stultz <johnstul@us.ibm.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] time : SMP friendly alignment of struct clocksource
Date: Tue, 20 Mar 2007 10:58:02 -0700 [thread overview]
Message-ID: <1174413482.17430.1.camel@localhost> (raw)
In-Reply-To: <20070320110936.1e445e6e.dada1@cosmosbay.com>
On Tue, 2007-03-20 at 11:09 +0100, Eric Dumazet wrote:
> struct clocksource is a critical data structure.
>
> Most of its fields are read only, some of them are heavily modified at each timer interrupt.
>
> It makes sense to separate those fields and make sure they all share one cache line, or at least the minimum for machines with small cache lines.
>
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Sounds fine to me. Can you actually observe a difference?
Acked-by: John Stultz <johnstul@us.ibm.com>
> --- linux-2.6.21-rc4-mm1/include/linux/clocksource.h
> +++ linux-2.6.21-rc4-mm1-ed/include/linux/clocksource.h
> @@ -49,25 +49,35 @@ struct clocksource;
> * @flags: flags describing special properties
> * @vread: vsyscall based read
> * @cycle_interval: Used internally by timekeeping core, please ignore.
> * @xtime_interval: Used internally by timekeeping core, please ignore.
> */
> struct clocksource {
> + /*
> + * First part of structure is read mostly
> + */
> char *name;
> struct list_head list;
> int rating;
> cycle_t (*read)(void);
> cycle_t mask;
> u32 mult;
> u32 shift;
> unsigned long flags;
> cycle_t (*vread)(void);
>
> /* timekeeping specific data, ignore */
> - cycle_t cycle_last, cycle_interval;
> - u64 xtime_nsec, xtime_interval;
> + cycle_t cycle_interval;
> + u64 xtime_interval;
> + /*
> + * Second part is written at each timer interrupt
> + * Keep it in a different cache line to dirty no
> + * more than one cache line.
> + */
> + cycle_t cycle_last ____cacheline_aligned_in_smp;
> + u64 xtime_nsec;
> s64 error;
>
> #ifdef CONFIG_CLOCKSOURCE_WATCHDOG
> /* Watchdog related data, used by the framework */
> struct list_head wd_list;
> cycle_t wd_last;
next prev parent reply other threads:[~2007-03-20 17:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-20 10:09 [PATCH] time : SMP friendly alignment of struct clocksource Eric Dumazet
2007-03-20 17:58 ` john stultz [this message]
2007-03-20 18:04 ` Daniel Walker
2007-03-20 18:38 ` john stultz
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=1174413482.17430.1.camel@localhost \
--to=johnstul@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dada1@cosmosbay.com \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.