Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Fri, 14 Feb 2003 04:43:38 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Fri, 14 Feb 2003 04:27:36 -0500 Received: from modemcable092.130-200-24.mtl.mc.videotron.ca ([24.200.130.92]:42579 "EHLO montezuma.mastecende.com") by vger.kernel.org with ESMTP id ; Fri, 14 Feb 2003 04:25:42 -0500 Date: Fri, 14 Feb 2003 04:34:06 -0500 (EST) From: Zwane Mwaikambo X-X-Sender: zwane@montezuma.mastecende.com To: Linux Kernel cc: Jeff Dike , Linus Torvalds Subject: [PATCH][2.5][13/14] smp_call_function_on_cpu - UML Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2003 Lines: 71 smp.c | 31 ++++++++++++++++++++----------- 1 files changed, 20 insertions(+), 11 deletions(-) Index: linux-2.5.60/arch/um/kernel/smp.c =================================================================== RCS file: /build/cvsroot/linux-2.5.60/arch/um/kernel/smp.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 smp.c --- linux-2.5.60/arch/um/kernel/smp.c 10 Feb 2003 22:15:17 -0000 1.1.1.1 +++ linux-2.5.60/arch/um/kernel/smp.c 14 Feb 2003 07:46:06 -0000 @@ -255,15 +255,19 @@ 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 cpus = num_online_cpus() - 1; - int i; - - if (!cpus) - return 0; + int i, cpu, num_cpus; + cpu = get_cpu(); + mask &= ~(1UL << cpu); + num_cpus = hweight32(mask); + if (num_cpus == 0) { + put_cpu_no_resched(); + return -EINVAL; + } + spin_lock_bh(&call_lock); atomic_set(&scf_started, 0); atomic_set(&scf_finished, 0); @@ -271,19 +275,24 @@ info = _info; for (i=0;ithread_info->cpu) && - test_bit(i, &cpu_online_map)) + if (cpu_online(i) && ((1UL << i) & mask)) write(cpu_data[i].ipi_pipe[1], "C", 1); - while (atomic_read(&scf_started) != cpus) + while (atomic_read(&scf_started) != num_cpus) barrier(); if (wait) - while (atomic_read(&scf_finished) != cpus) + 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) +{ + return smp_call_function_on_cpu(_func, _info, wait, cpu_online_map); } #endif - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/