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

> 	for (i = 0; i < NR_CPUS; i++) {
> 		if (!cpu_online(i))
> 			continue;
> 
> Since the cpu online map is probably going to be quite sparse,
> could I suggest this alternative, which doesn't have to loop 32 times:

> +#define for_each_cpu(cpu, mask) \
> +       for(mask = cpu_online_map; \
> +           cpu = __ffs(mask), mask != 0; \
> +           mask &= ~(1<<cpu))
> +

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

-- Pete

       reply	other threads:[~2002-06-21  4:16 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 ` Pete Zaitcev [this message]
2002-06-21 13:10   ` Optimisation for smp_num_cpus loop in hotplug James Bottomley
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=200206210416.g5L4GIx16142@devserv.devel.redhat.com \
    --to=zaitcev@redhat.com \
    --cc=James.Bottomley@SteelEye.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.