From patchwork Tue May 28 13:08:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 10964891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AF451575 for ; Tue, 28 May 2019 13:10:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB1692843B for ; Tue, 28 May 2019 13:10:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D90B828495; Tue, 28 May 2019 13:10:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 790BF2843B for ; Tue, 28 May 2019 13:10:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVbpz-0007tD-GW; Tue, 28 May 2019 13:08:19 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVbpy-0007t8-Ec for xen-devel@lists.xenproject.org; Tue, 28 May 2019 13:08:18 +0000 X-Inumbo-ID: a7d05117-8149-11e9-8980-bc764e045a96 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id a7d05117-8149-11e9-8980-bc764e045a96; Tue, 28 May 2019 13:08:16 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4FFB3AEF3; Tue, 28 May 2019 13:08:15 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Tue, 28 May 2019 15:08:11 +0200 Message-Id: <20190528130811.26480-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH] xen: remove on-stack cpumask from stop_machine_run() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The "allbutself" cpumask in stop_machine_run() is not needed. Instead of allocating it on the stack it can easily be avoided. Signed-off-by: Juergen Gross --- xen/common/stop_machine.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xen/common/stop_machine.c b/xen/common/stop_machine.c index ce6f5624c4..ccda2efa3e 100644 --- a/xen/common/stop_machine.c +++ b/xen/common/stop_machine.c @@ -69,8 +69,8 @@ static void stopmachine_wait_state(void) int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) { - cpumask_t allbutself; unsigned int i, nr_cpus; + unsigned int my_cpu = smp_processor_id(); int ret; BUG_ON(!local_irq_is_enabled()); @@ -79,9 +79,7 @@ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) if ( !get_cpu_maps() ) return -EBUSY; - cpumask_andnot(&allbutself, &cpu_online_map, - cpumask_of(smp_processor_id())); - nr_cpus = cpumask_weight(&allbutself); + nr_cpus = cpumask_weight(&cpu_online_map) - 1; /* Must not spin here as the holder will expect us to be descheduled. */ if ( !spin_trylock(&stopmachine_lock) ) @@ -100,8 +98,9 @@ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) smp_wmb(); - for_each_cpu ( i, &allbutself ) - tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i); + for_each_cpu ( i, &cpu_online_map ) + if ( i != my_cpu ) + tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i); stopmachine_set_state(STOPMACHINE_PREPARE); stopmachine_wait_state();