From nobody Tue May 7 22:14:28 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1559303663; cv=none; d=zoho.com; s=zohoarc; b=iQdf4ShqO+Sy5mTEN62kz5FSqgXjGw7NEvJwRV6IuK1eghFx4ihHxhmLXg3o8Wg2KnOGKjgbt2+3mLwXSw5uno0TpFcqubw6BbwV1uzm2EN+789f+Ve0HwBxO9kNiWzl5pHYaZO9U6ZQCjWHDpdDf8c+VqPp4ZWd5BFi8vSXBGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559303663; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=d6rV6RgChO2EhH77iQT3wRDJhbeU/MsNZxtGpMIz+Cs=; b=XK7KnWx3h7euLB+DmsGUj/tkpVp+E6j0aBgJIAmXm9Wfc/ZhVDONg6bsHvyfgvgwSjn3Cl2Po1BHjQTd4cqccbLW/8Kce+ib/B5kY1ZmE3B04tvR2ip+wFzzwhet3AMDHYnyiPdVN93rzobmXWMMsyIbU49kbBx8et1TyMqJeuU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 155930366376213.563021489704852; Fri, 31 May 2019 04:54:23 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hWg5u-00019e-9Z; Fri, 31 May 2019 11:53:10 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hWg5s-00019Z-8F for xen-devel@lists.xenproject.org; Fri, 31 May 2019 11:53:08 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id a6dce80c-839a-11e9-8980-bc764e045a96; Fri, 31 May 2019 11:53:06 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6388DAEC2; Fri, 31 May 2019 11:53:05 +0000 (UTC) X-Inumbo-ID: a6dce80c-839a-11e9-8980-bc764e045a96 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Fri, 31 May 2019 13:53:03 +0200 Message-Id: <20190531115303.16459-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH v2] 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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 Reviewed-by: Jan Beulich --- xen/common/stop_machine.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/common/stop_machine.c b/xen/common/stop_machine.c index ce6f5624c4..74d04427bd 100644 --- a/xen/common/stop_machine.c +++ b/xen/common/stop_machine.c @@ -69,8 +69,8 @@ static void stopmachine_wait_state(void) =20 int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) { - cpumask_t allbutself; unsigned int i, nr_cpus; + unsigned int this =3D smp_processor_id(); int ret; =20 BUG_ON(!local_irq_is_enabled()); @@ -79,9 +79,9 @@ int stop_machine_run(int (*fn)(void *), void *data, unsig= ned int cpu) if ( !get_cpu_maps() ) return -EBUSY; =20 - cpumask_andnot(&allbutself, &cpu_online_map, - cpumask_of(smp_processor_id())); - nr_cpus =3D cpumask_weight(&allbutself); + nr_cpus =3D num_online_cpus(); + if ( cpu_online(this) ) + nr_cpus--; =20 /* Must not spin here as the holder will expect us to be descheduled. = */ if ( !spin_trylock(&stopmachine_lock) ) @@ -100,8 +100,9 @@ int stop_machine_run(int (*fn)(void *), void *data, uns= igned int cpu) =20 smp_wmb(); =20 - for_each_cpu ( i, &allbutself ) - tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i); + for_each_online_cpu ( i ) + if ( i !=3D this ) + tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i); =20 stopmachine_set_state(STOPMACHINE_PREPARE); stopmachine_wait_state(); --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel