* [PATCH][2.5][13/15] smp_call_function/_on_cpu - uml
@ 2003-02-09 12:08 Zwane Mwaikambo
0 siblings, 0 replies; only message in thread
From: Zwane Mwaikambo @ 2003-02-09 12:08 UTC (permalink / raw
To: Linux Kernel
smp.c | 39 +++++++++++++++++++++++++++++++++++++--
1 files changed, 37 insertions(+), 2 deletions(-)
Index: linux-2.5.59-bk/arch/um/kernel/smp.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.59-bk/arch/um/kernel/smp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 smp.c
--- linux-2.5.59-bk/arch/um/kernel/smp.c 9 Feb 2003 09:08:37 -0000 1.1.1.1
+++ linux-2.5.59-bk/arch/um/kernel/smp.c 9 Feb 2003 09:23:30 -0000
@@ -255,8 +255,43 @@
atomic_inc(&scf_finished);
}
-int smp_call_function(void (*_func)(void *info), void *_info, int nonatomic,
- int wait)
+int smp_call_function_on_cpu(void (*_func)(void *info), void *_info, int wait,
+ unsigned long mask)
+{
+ int i, cpu, num_cpus = hweight32(mask);
+
+ if (num_cpus == 0)
+ return 0;
+
+ cpu = get_cpu();
+ if ((1UL << cpu) && mask) {
+ put_cpu_no_resched();
+ return 0;
+ }
+
+ spin_lock_bh(&call_lock);
+ atomic_set(&scf_started, 0);
+ atomic_set(&scf_finished, 0);
+ func = _func;
+ info = _info;
+
+ for (i=0;i<NR_CPUS;i++)
+ if (cpu_online(i) && ((1UL << i) & mask))
+ write(cpu_data[i].ipi_pipe[1], "C", 1);
+
+ while (atomic_read(&scf_started) != num_cpus)
+ barrier();
+
+ if (wait)
+ while (atomic_read(&scf_finished) != num_cpus)
+ barrier();
+
+ spin_unlock_bh(&call_lock);
+ put_cpu_no_resched();
+ return 0;
+}
+
+int smp_call_function(void (*_func)(void *info), void *_info, int wait)
{
int cpus = num_online_cpus() - 1;
int i;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-09 12:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-09 12:08 [PATCH][2.5][13/15] smp_call_function/_on_cpu - uml Zwane Mwaikambo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).