[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/smp: Speed up on_selected_cpus()


  • To: Julien Grall <julien@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Mon, 7 Feb 2022 17:30:26 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V4d6ybWiEa/Ld6eapg8aG+8Qyid761iXYUAw8ZLMYZA=; b=UGvHqpvp1rbGMZDZFMESiAyqMIES7NBzmAb7E799UzX/zj0ZZmPgjMSSOxUPERuwoqtGgPSerxF7fQVjkEnopzJo/mAk2fCdMfMTedhSQhFpxXgu5lg+ncuZLKrw/GlFGWfTIyn8YNl61Xt8zU3B16gVO4e6lnhppMoxwgL5pscdtPuX8xGQgezXZsFWaBI1Q+x3tgcSEQAPrQBJItRzeoHYdSAgymYWJZzk5u2xQzyBWDcwfqXqAz7UeE34qz1p0RXipzs2N5HzmUkAOe9cB58/YypWhuxK1+WCH+kmDGpAlNMxZs9ub/06WBy0w1VQo+X15qQAcbzwqODB9odepA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hfhrg1CYK/YY2MRKEGQqRtyj9fomHsB2X5cZMHdwBarl5T9vU5Q2CPGaug4lJ/xLRyvVTo+/Umbx9PCz+LB/TiCtDOxwh7AB/5rDFInoTWwwFYEssG5vHPhV6r9uahztjiBvMBkSY8+uTrYa56rjyitvmxOjyygtRmhb3ryL5ajoxF6fuv2XDv++UaGS11DlAj8sM2U4UD9YkOqIWovNsHInL5cWe8JEv4hdzp10ikZY8IpuDrDa4oUfqlrM4BlKxY0WXWKWdl/KPG9nThJqoDoKnAA5MkBN1vDiGuWHCZ3bLECRVXI5LShQNYK2pRdBWLKKNQOHYi5UuyTzcheMjw==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Mon, 07 Feb 2022 17:30:44 +0000
  • Ironport-data: A9a23:FjCL6atb3Tqvu4F5iY28wvzKZOfnVBhYMUV32f8akzHdYApBsoF/q tZmKTqGPqnZZGuhLdAnOty28RxXvpLcz4MyQQFl+3wyFisT+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZQP0VOZigHtIQMsadUsxKbVIiGHdJZS5LwbZj2NYy2YfhWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ Nplvruecg04BqD1g+VaUx8DSwx7O6pN0eqSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DFYUToHx/ixreCu4rW8vrSKTW/95Imjw3g6iiGN6AP JNDMmU2MHwsZTVGBFpKKokxrt2ipUKvcBFIi3KJtYQOtj27IAtZj+G2bYu9lsaxbd5Ogk+Sq 2bC/mL4KhIXLtqSzXyC6H3Eru3AhyTgQ6oJCaa1sPVthTW7zGE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lxgBV/BQ2Uh9Rn0dO3O9EM 2R2M1F4ePeV9DByickfB22hFmmt3vFCFpAdH7fRqFDkcg==
  • Ironport-hdrordr: A9a23:JfTnu6j/9966+237TjybFOSpTHBQXt4ji2hC6mlwRA09TyX+rb HIoB17726RtN91YhodcL+7VJVoLUmyyXcX2+ks1NWZMjUO0VHAROsO0WKI+VzdMhy72ulB1b pxN4hSYeeAaGSSVPyKgzVQxexQouW6zA==
  • Ironport-sdr: lwO0WcjaoKWZYHY8QbRIfeKjU8AuTdv5My/GvARdrlu0edbXU3/gOpuFUir5dvgL3hRGAr1jqo QYlrCMXFqcO1JVhrszjP0/XCOOeXLAhk2IjOlnUBKw9iSL6xtlVD0YZw4+sOTrkW6YUfZAWxjF kP4gg9aw/F00RNhBzaZ5LCIORO8F6jAecYw1231Rad+5aTaTLz0/Dov2o7gq1cZglkfv8NNBut O3a49nupQLEOYhO91lR/g1uvLNeltGq3VrNZPKt9uSwomOe0QQzMIp6AtteObXoTRRYL/lWEHQ TSTuhhDTATbE5vM5zT3huw71
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYGgY/F0hg0t0KmkKX/IIzwuTua6yG7rMAgAFuCIA=
  • Thread-topic: [PATCH] xen/smp: Speed up on_selected_cpus()

On 06/02/2022 19:40, Julien Grall wrote:
> Hi,
>
> On 04/02/2022 20:31, Andrew Cooper wrote:
>> cpumask_weight() is a horribly expensive way to find if no bits are
>> set, made
>> worse by the fact that the calculation is performed with the global
>> call_lock
>> held.
>
> I looked at the archive because I was wondering why we were using
> cpumask_weight here. It looks like this was a left-over of the rework
> in ac3fc35d919c "x86: Fix flush_area_mask() and on_selected_cpus() to
> not race updates".

That change shuffled the code, but didn't introduce the problem.

I'm pretty sure it was 433f14699d48 which dropped the !=0 user of nr_cpus.


Talking of, there is more efficiency to be gained by reworking the
second cpumask_empty() call to not restart from 0 on failure, because
that removes useless reads.


>
>>
>> Switch to using cpumask_empty() instead, which will short circuit as
>> soon as
>> it find any set bit in the cpumask.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>
> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>

Thanks.

~Andrew

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.