From: Anton Altaparmakov <aia21@cantab.net>
To: Andrew Morton <akpm@zip.com.au>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
torvalds@transmeta.com, linux-kernel@vger.kernel.org,
k-suganuma@mvj.biglobe.ne.jp
Subject: Re: [PATCH] 2.5.21 Nonlinear CPU support
Date: Tue, 11 Jun 2002 12:22:15 +0100 [thread overview]
Message-ID: <5.1.0.14.2.20020611120032.00aec7f0@pop.cus.cam.ac.uk> (raw)
In-Reply-To: <3D05C27D.186DC066@zip.com.au>
At 10:27 11/06/02, Andrew Morton wrote:
>Rusty Russell wrote:
> >
> > ...
> > Let's not perpetuate the myth that everything in the kernel needs to
> > be tuned to the last cycle at all costs, hm?
>
>I was more concerned about the RAM use, actually.
>
>This patch is an additional reason for CONFIG_NR_CPUS, but I've rather
>gone cold on that idea because the "proper fix" is to make all those
>huge per-cpu arrays dynamically allocated. So you can run a 64p kernel
>on 2p without losing hundreds of k of memory and kernel address space.
>
>But it looks like all those dynamically-allocated structures would
>have to be allocated out to NR_CPUS anyway, to support hotplug, yes?
>
>In which case, CONFIG_NR_CPUS is the only way to get the memory
>back...
Why? You can get rid of all uses of NR_CPUS (except for using it as a max
capping value so none goes above it) and always use smp_num_cpus instead.
And make the cpu hotplug code update smp_num_cpus as appropriate.
All code relying on smp_num_cpus for per-cpu buffers can do a check whether
the current cpu is greater than the value of smp_num_cpus at per-cpu buffer
allocation time and if so lock the kernel (or only the buffers if possible)
and grow the buffer allocation up to the new smp_num_cpus value. And all
that can be done nicely out of line in a really, really, snail speed slow
path... The fastpath only needs to contain:
cpu = smp_processor_id();
#ifdef CONFIG_HOTPLUG_CPU
if (unlikely(cpu >= old_smp_num_cpus))
goto snail_path;
snail_path_done:
#endif
So zero penalty for non-hotplug users and loads of penalty for hotplug
users but frankly I couldn't care less for those. The slow path will
trigger so seldom it is not worth thinking about the performance hit there.
You could even make the above look nicer by making it a function like:
cpu = smp_processor_id();
check_for_cpu_hotplug_event(cpu, old_smp_num_cpus, our_hotplug_callback);
And let our_hotplug_callback() deal with the case where cpu is >=
old_smp_num_cpus, for example for ntfs that would involve extending the
number of per-cpu buffers. And in the !CONFIG_HOTPLUG_CPU case the whole
check_for_cpu_hotplug_event function becomes a NOP. All in the spirit of
not having #ifdefs sprinkled around the code.
There are a lot of ways to deal with this corner case dynamically, so
please use one of them. I don't buy the "lets penalise 99% of users for the
sake of a feature that almost noone will ever use" argument.
Best regards,
Anton
--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
next prev parent reply other threads:[~2002-06-11 11:18 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 [this message]
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
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=5.1.0.14.2.20020611120032.00aec7f0@pop.cus.cam.ac.uk \
--to=aia21@cantab.net \
--cc=akpm@zip.com.au \
--cc=k-suganuma@mvj.biglobe.ne.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@transmeta.com \
/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®