All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@steeleye.com>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Optimisation for smp_num_cpus loop in hotplug
Date: Fri, 21 Jun 2002 09:10:21 -0400	[thread overview]
Message-ID: <200206211310.g5LDALT02295@localhost.localdomain> (raw)
In-Reply-To: Message from Pete Zaitcev <zaitcev@redhat.com>  of "Fri, 21 Jun 2002 00:16:18 EDT." <200206210416.g5L4GIx16142@devserv.devel.redhat.com>

zaitcev@redhat.com said:
> This is neat, but I'd like to see it work with O(1) as well. Mingo's
> code uses some long bitmaps. 

Well, it's strictly only for the cpu bitmap (and it's designed to be different 
depending on the arch so you can use arch specific CPU enumeration knowlege).  
The O(1) optimisation for this is easy:

#ifdef CONFIG_SMP
#define for_each_cpu(cpu, mask) \
        for(mask = cpu_online_map; \
            cpu = __ffs(mask), mask != 0; \
            mask &= ~(1<<cpu))
#else
#define for_each_cpu(cpu, mask) cpu = 1; 
#endif

because you don't really want to run an SMP kernel on a machine which has only 
one cpu.  Or did you mean you'd like to see it work with the O(1) scheduler, 
some kind of generic for_each_set_bit?

James



  reply	other threads:[~2002-06-21 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1024617156.25656.linux-kernel2news@redhat.com>
2002-06-21  4:16 ` Optimisation for smp_num_cpus loop in hotplug Pete Zaitcev
2002-06-21 13:10   ` James Bottomley [this message]
2002-06-20 23:41 James Bottomley
2002-06-21 15:14 ` Rusty Russell
2002-06-21 15:31   ` James Bottomley
2002-06-21 19:17     ` Rusty Russell

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=200206211310.g5LDALT02295@localhost.localdomain \
    --to=james.bottomley@steeleye.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zaitcev@redhat.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 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.