From: Rusty Russell <rusty@rustcorp.com.au>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.5.21 Nonlinear CPU support
Date: Thu, 13 Jun 2002 12:42:13 +1000 [thread overview]
Message-ID: <E17IKYw-00032x-00@wagner.rustcorp.com.au> (raw)
In-Reply-To: Your message of "Wed, 12 Jun 2002 15:10:48 +0200." <15623.18520.760673.208158@kim.it.uu.se>
In message <15623.18520.760673.208158@kim.it.uu.se> you write:
> This means keeping a logical->physical map and iterating like this:
>
> for(i = 0; i < nr_online_cpus; ++i)
> do_something_with(cpu_logical_map(i));
>
> (I care because my performance-monitoring counters driver by necessity
> is closely tied to CPU identities and the set of online CPUs.)
I disagreed, so I measured, and you are right 8( I hate that.
Simply reading the performance monitors across all CPUs is a case
where the extra loop overhead is significant (although cache effects
may still dominate): 9 times slower on PPC if there are only 2 CPUs
and NR_CPUS is 32.
I'd definitely prefer a per-arch for_each_cpu() implementation to
exposing a mapping, eg:
/* No hotplug cpus on this arch. */
extern int max_cpu_num;
#define for_each_cpu(__i) for (__i = 0; __i < max_cpu_num; __i++)
OR
extern int cpu_next_map[NR_CPUS];
#define for_each_cpu(__i) \
for (__i = 0; __i < NR_CPUS; __i = cpu_next_map[__i])
[ Soapbox mode: cut here ]
My philosophy is that parts of infrastructure which is not used by >
90% of people tends to get misused. Two recent concrete examples:
cpu_logical_map() is currently a noop on x86
=> Ingo fucked it up in his initial scheduler impl.
copy_from_user() returns POSTIVE on failure
=> 7% of uses of copy_from_user were buggy in 2.5.19.
My feeling is that kernel coding is becoming more challenging (SMP,
preemption, portability), and our bug count and time-to-kernel-mastery
is climbing as a result. One method of countering this is by
carefully designing infrastructure to make the simplest method for
writing common operations also the correct one.
Sometimes old-timers don't see infrastructure they are used to as a
problem, but even they make mistakes.
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
next prev parent reply other threads:[~2002-06-13 2:42 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-11 7:08 Rusty Russell
2002-06-11 7:42 ` Andrew Morton
2002-06-11 9:09 ` Rusty Russell
2002-06-11 9:10 ` David S. Miller
2002-06-12 6:58 ` Rusty Russell
2002-06-12 9:26 ` David S. Miller
2002-06-13 5:01 ` Rusty Russell
2002-06-13 5:55 ` David S. Miller
2002-06-11 9:27 ` Andrew Morton
2002-06-11 11:22 ` Anton Altaparmakov
2002-06-12 5:57 ` Rusty Russell
2002-06-12 7:54 ` Anton Altaparmakov
2002-06-12 8:06 ` Rusty Russell
2002-06-12 8:25 ` Anton Altaparmakov
2002-06-12 19:32 ` Linus Torvalds
2002-06-12 13:10 ` Mikael Pettersson
2002-06-13 2:42 ` Rusty Russell [this message]
2002-06-12 0:53 ` Rusty Russell
2002-06-12 8:36 ` Helge Hafting
2002-06-11 10:57 ` Anton Altaparmakov
2002-06-11 17:59 ` Robert Love
2002-06-12 4:11 ` Rusty Russell
2002-06-11 19:29 ` Denis Vlasenko
2002-06-11 14:54 ` Anton Altaparmakov
2002-06-12 19:32 ` Denis Vlasenko
2002-06-12 15:08 ` Anton Altaparmakov
2002-06-12 17:36 ` Andreas Dilger
2002-06-12 18:34 ` Anton Altaparmakov
2002-06-12 19:39 ` Andreas Dilger
2002-06-12 20:41 ` Anton Altaparmakov
2002-06-12 21:03 ` Andreas Dilger
2002-06-12 21:15 ` Anton Altaparmakov
2002-06-12 20:03 ` H. Peter Anvin
2002-06-12 20:54 ` Robert Love
2002-06-12 20:57 ` Anton Altaparmakov
2002-06-12 22:21 ` H. Peter Anvin
2002-06-13 1:33 ` Anton Altaparmakov
2002-06-13 1:38 ` H. Peter Anvin
2002-06-13 1:45 ` Anton Altaparmakov
2002-06-13 2:13 ` H. Peter Anvin
2002-06-13 2:21 ` Anton Altaparmakov
2002-06-13 8:43 ` Helge Hafting
2002-06-11 18:01 ` Robert Love
2002-06-12 7:57 ` Alan Cox
2002-06-12 8:01 ` Rusty Russell
[not found] <Pine.LNX.4.33.0206121226550.1533-100000@penguin.transmeta. com>
2002-06-12 21:29 ` Anton Altaparmakov
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=E17IKYw-00032x-00@wagner.rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpe@csd.uu.se \
/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
all inboxes | Powered by JetHome®