From: Paul Jackson <pj@sgi.com>
To: Paul Jackson <pj@sgi.com>
Cc: colpatch@us.ibm.com, wli@holomorphy.com, rusty@rustcorp.com.au,
linux-kernel@vger.kernel.org
Subject: Patch 11/23 - Bitmaps, Cpumasks and Nodemasks
Date: Thu, 8 Apr 2004 12:49:48 -0700 [thread overview]
Message-ID: <20040408124948.2e805e64.pj@sgi.com> (raw)
In-Reply-To: <20040408115050.2c67311a.pj@sgi.com>
P11.cpumask_sparc_simplify - Simplify some sparc64 cpumask loop code
Make use of for_each_cpu_mask() macro to simplify and optimize
a couple of sparc64 per-CPU loops. This code change has _not_
been tested or reviewed. Feedback welcome. There is non-trivial
risk that I still don't understand the logic here.
Index: 2.6.5.bitmap/arch/sparc64/kernel/smp.c
===================================================================
--- 2.6.5.bitmap.orig/arch/sparc64/kernel/smp.c 2004-04-05 02:41:32.000000000 -0700
+++ 2.6.5.bitmap/arch/sparc64/kernel/smp.c 2004-04-08 04:18:02.000000000 -0700
@@ -406,14 +406,8 @@
int i;
__asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate));
- for (i = 0; i < NR_CPUS; i++) {
- if (cpu_isset(i, mask)) {
- spitfire_xcall_helper(data0, data1, data2, pstate, i);
- cpu_clear(i, mask);
- if (cpus_empty(mask))
- break;
- }
- }
+ for_each_cpu_mask(i, mask)
+ spitfire_xcall_helper(data0, data1, data2, pstate, i);
}
/* Cheetah now allows to send the whole 64-bytes of data in the interrupt
@@ -456,25 +450,19 @@
nack_busy_id = 0;
{
- cpumask_t work_mask = mask;
int i;
- for (i = 0; i < NR_CPUS; i++) {
- if (cpu_isset(i, work_mask)) {
- u64 target = (i << 14) | 0x70;
-
- if (!is_jalapeno)
- target |= (nack_busy_id << 24);
- __asm__ __volatile__(
- "stxa %%g0, [%0] %1\n\t"
- "membar #Sync\n\t"
- : /* no outputs */
- : "r" (target), "i" (ASI_INTR_W));
- nack_busy_id++;
- cpu_clear(i, work_mask);
- if (cpus_empty(work_mask))
- break;
- }
+ for_each_cpu_mask(i, mask) {
+ u64 target = (i << 14) | 0x70;
+
+ if (!is_jalapeno)
+ target |= (nack_busy_id << 24);
+ __asm__ __volatile__(
+ "stxa %%g0, [%0] %1\n\t"
+ "membar #Sync\n\t"
+ : /* no outputs */
+ : "r" (target), "i" (ASI_INTR_W));
+ nack_busy_id++;
}
}
@@ -507,7 +495,6 @@
printk("CPU[%d]: mondo stuckage result[%016lx]\n",
smp_processor_id(), dispatch_stat);
} else {
- cpumask_t work_mask = mask;
int i, this_busy_nack = 0;
/* Delay some random time with interrupts enabled
@@ -518,22 +505,17 @@
/* Clear out the mask bits for cpus which did not
* NACK us.
*/
- for (i = 0; i < NR_CPUS; i++) {
- if (cpu_isset(i, work_mask)) {
- u64 check_mask;
-
- if (is_jalapeno)
- check_mask = (0x2UL << (2*i));
- else
- check_mask = (0x2UL <<
- this_busy_nack);
- if ((dispatch_stat & check_mask) == 0)
- cpu_clear(i, mask);
- this_busy_nack += 2;
- cpu_clear(i, work_mask);
- if (cpus_empty(work_mask))
- break;
- }
+ for_each_cpu_mask(i, mask) {
+ u64 check_mask;
+
+ if (is_jalapeno)
+ check_mask = (0x2UL << (2*i));
+ else
+ check_mask = (0x2UL <<
+ this_busy_nack);
+ if ((dispatch_stat & check_mask) == 0)
+ cpu_clear(i, mask);
+ this_busy_nack += 2;
}
goto retry;
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
next prev parent reply other threads:[~2004-04-08 20:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-08 18:50 Patch 0/23 - Bitmaps, Cpumasks and Nodemasks Paul Jackson
2004-04-08 19:47 ` Patch 1/23 " Paul Jackson
2004-04-08 19:48 ` Patch 2/23 " Paul Jackson
2004-04-08 19:48 ` Patch 3/23 " Paul Jackson
2004-04-08 19:48 ` Patch 4/23 " Paul Jackson
2004-04-08 19:48 ` Patch 5/23 " Paul Jackson
2004-04-08 19:49 ` Patch 6a/23 " Paul Jackson
2004-04-08 19:49 ` Patch 6b/23 " Paul Jackson
2004-04-08 19:49 ` Patch 6c/23 " Paul Jackson
2004-04-08 19:49 ` Patch 7/23 " Paul Jackson
2004-04-08 19:49 ` Patch 8/23 " Paul Jackson
2004-04-08 19:49 ` Patch 9/23 " Paul Jackson
2004-04-08 19:49 ` Patch 10/23 " Paul Jackson
2004-04-08 19:49 ` Paul Jackson [this message]
2004-04-08 19:49 ` Patch 12/23 " Paul Jackson
2004-04-08 19:49 ` Patch 13/23 " Paul Jackson
2004-04-08 19:49 ` Patch 14/23 " Paul Jackson
2004-04-08 19:50 ` Patch 15/23 " Paul Jackson
2004-04-08 19:50 ` Patch 16/23 " Paul Jackson
2004-04-08 19:50 ` Patch 17/23 " Paul Jackson
2004-04-08 19:50 ` Patch 18/23 " Paul Jackson
2004-04-08 19:50 ` Patch 19/23 " Paul Jackson
2004-04-08 19:50 ` Patch 20/23 " Paul Jackson
2004-04-08 19:50 ` Patch 21/23 " Paul Jackson
2004-04-08 19:50 ` Patch 22/23 " Paul Jackson
2004-04-08 19:50 ` Patch 23/23 " Paul Jackson
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=20040408124948.2e805e64.pj@sgi.com \
--to=pj@sgi.com \
--cc=colpatch@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=wli@holomorphy.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