public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: akpm@osdl.org, kernel-stuff@comcast.net,
	linux-kernel@vger.kernel.org, alex-kernel@digriz.org.uk,
	jun.nakajima@intel.com, davej@redhat.com
Subject: Re: OOPS: 2.6.16-rc6 cpufreq_conservative
Date: Sat, 18 Mar 2006 21:08:40 -0800	[thread overview]
Message-ID: <20060318210840.e7156b6b.pj@sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0603181827530.3826@g5.osdl.org>

If find_first_bit and find_next_bit suck so bad, then why just fix
their use in the for_each_cpu_mask().  How about the other uses?

Such as the other 50 odd places in the kernel that call them directly,
such as:

	$ grep ' = find_[a-z]*_bit' lib/bitmap.c
	    rbot = cur = find_first_bit(maskp, nmaskbits);
		    cur = find_next_bit(maskp, nmaskbits, cur+1);
	    i = find_first_bit(buf, bits);
		    i = find_next_bit(buf, bits, i + 1);
		    for (i = find_first_bit(buf, bits);
			 i = find_next_bit(buf, bits, i + 1))
	    for (oldbit = find_first_bit(src, bits);
		 oldbit = find_next_bit(src, bits, oldbit + 1)) {

Perhaps the common interface to these find_*_bit routines should be out
of line, with perhaps just a couple of key calls from the scheduler
using the inline form.

And if we fix the cpu loop to the API Linus suggests, we should do the
same with the node loops, such as used in:

	$ grep for_each.*_node mm/slab.c
		    for_each_node(i) {
	    for_each_node(i)
	    for_each_online_node(i) {
		    for_each_online_node(node) {
	    for_each_online_node(node) {
			    for_each_online_node(node) {
	    for_each_online_node(node) {
	    for_each_online_node(i) {
	    for_each_online_node(i) {
	    for_each_online_node(node) {
	    for_each_online_node(node) {
	    for_each_online_node(node) {
	    for_each_online_node(node) {

And for those of us with too many CPUs, how about something like
(totally untested and probably totally bogus):

	#if NR_CPUS <= BITS_IN_LONG
	 ... as per Linus, shifting a mask right ...
	#else
	#define for_each_cpu_mask(cpu, mask)
		{ for (cpu = 0; cpu < NR_CPUS; cpu++) {
			if (!(test_bit(cpu, mask))
				continue;
	#endif

	#define end_for_each_cpu_mask	} }	

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

  reply	other threads:[~2006-03-19  5:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-18 20:25 OOPS: 2.6.16-rc6 cpufreq_conservative Parag Warudkar
2006-03-18 21:40 ` Linus Torvalds
2006-03-18 22:09   ` Parag Warudkar
2006-03-18 23:12     ` Linus Torvalds
2006-03-18 22:26   ` Parag Warudkar
2006-03-19  0:53   ` Andrew Morton
2006-03-19  2:38     ` Linus Torvalds
2006-03-19  5:08       ` Paul Jackson [this message]
2006-03-19 17:43         ` Linus Torvalds
2006-03-19 18:46       ` Linus Torvalds
2006-03-19 19:02         ` Linus Torvalds
2006-03-19 19:33           ` Linus Torvalds
2006-03-19 19:40             ` Al Viro
2006-03-19 20:01               ` Linus Torvalds
2006-03-19 20:31                 ` Linus Torvalds
2006-03-19 20:47                   ` Andrew Morton
2006-03-19 22:18                     ` Linus Torvalds
2006-03-19 22:35                       ` Andrew Morton
2006-03-19 22:55                         ` Linus Torvalds
2006-03-19 22:46                       ` Linus Torvalds
2006-03-19 23:04                         ` Andrew Morton
2006-03-19 20:57                   ` Parag Warudkar
2006-03-20  6:12             ` Willy Tarreau
2006-03-20  6:26               ` Linus Torvalds
2006-03-20  7:18                 ` Willy Tarreau
2006-03-21  6:32                   ` Willy Tarreau
2006-03-20  8:22               ` Peter T. Breuer
2006-03-19  6:34     ` Parag Warudkar
2006-03-19 12:00       ` Alexander Clouter
2006-03-19 14:06         ` Parag Warudkar
2006-03-19 17:34           ` Alexander Clouter

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=20060318210840.e7156b6b.pj@sgi.com \
    --to=pj@sgi.com \
    --cc=akpm@osdl.org \
    --cc=alex-kernel@digriz.org.uk \
    --cc=davej@redhat.com \
    --cc=jun.nakajima@intel.com \
    --cc=kernel-stuff@comcast.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox