From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: akpm@linux-foundation.org
Cc: kosaki.motohiro@gmail.com, linux-kernel@vger.kernel.org,
venki@google.com, rusty@rustcorp.com.au
Subject: [PATCH] lib/cpumask.c: Optimize __any_online_cpu() calculation
Date: Wed, 15 Feb 2012 18:05:14 +0530 [thread overview]
Message-ID: <20120215123208.15623.73499.stgit@srivatsabhat.in.ibm.com> (raw)
__any_online_cpu() uses a for loop at the moment.
Instead, use cpumask_* operations to speed it up.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---
Actually, the patch posted at https://lkml.org/lkml/2012/2/15/101 removed
the last user of any_online_cpu() (and hence __any_online_cpu()).
However, since this is an exported symbol, I refrained from removing this
function altogether.
lib/cpumask.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/lib/cpumask.c b/lib/cpumask.c
index af3e5817..b25f53d 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -28,13 +28,7 @@ EXPORT_SYMBOL(__next_cpu_nr);
int __any_online_cpu(const cpumask_t *mask)
{
- int cpu;
-
- for_each_cpu(cpu, mask) {
- if (cpu_online(cpu))
- break;
- }
- return cpu;
+ return cpumask_any_and(mask, cpu_online_mask);
}
EXPORT_SYMBOL(__any_online_cpu);
next reply other threads:[~2012-02-15 12:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 12:35 Srivatsa S. Bhat [this message]
2012-02-15 12:57 ` Eric Dumazet
2012-02-15 14:19 ` Srivatsa S. Bhat
2012-02-15 22:51 ` Rusty Russell
2012-02-17 12:19 ` Srivatsa S. Bhat
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=20120215123208.15623.73499.stgit@srivatsabhat.in.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=kosaki.motohiro@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=venki@google.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®