From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09066C77B70 for ; Mon, 17 Apr 2023 08:09:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73CAA8E0003; Mon, 17 Apr 2023 04:09:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6ECF58E0001; Mon, 17 Apr 2023 04:09:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DBC38E0003; Mon, 17 Apr 2023 04:09:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 47AF38E0001 for ; Mon, 17 Apr 2023 04:09:16 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0B7821C64EB for ; Mon, 17 Apr 2023 08:09:16 +0000 (UTC) X-FDA: 80690157912.29.E04ABC0 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf13.hostedemail.com (Postfix) with ESMTP id 8772C20007 for ; Mon, 17 Apr 2023 08:09:13 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=KYCGIgs9; dkim=pass header.d=linutronix.de header.s=2020e header.b="R5NSZu/m"; spf=pass (imf13.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681718953; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Bh7I3HDrPo+//oWDymjnONVtxVeELt5F1rHHaav1vxA=; b=qslgUy0ds/cERa12mO2g+XUe7EOZmvRRfD3D1TDfrVH3HPA5OLLZqkQ89BrpAWD750VhUm pMnd1EKRrVKqkxTRWKM0RXVtKsUP+dvKypifBBRr6YKacuC/fPTdglzTJFTryb5rlFm52l 545DgrQBostdmipIcIaFgFLWfwDilAU= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=KYCGIgs9; dkim=pass header.d=linutronix.de header.s=2020e header.b="R5NSZu/m"; spf=pass (imf13.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681718953; a=rsa-sha256; cv=none; b=5sE14hbDsjLAPTNM08iHQYCi9J/mSQQe8P0zSyRQVG0yoE5hQwt/bkGv2NGXk0MJfq6Fd1 33JC5aJhH6q1N2E67rgItz9AuH+SxPvZZCGRgsxUt8UakNvhO6x0lDZWiu1Gdhe2xwobd6 jgLhoG6g10CgEIqtFHQiTL5Hknxx9jI= From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681718951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Bh7I3HDrPo+//oWDymjnONVtxVeELt5F1rHHaav1vxA=; b=KYCGIgs9db3NejMx//bF2IJi/hGwzy1oPLRe7psPVIGjGALewQFoJoDH7kxu/jgcctDb2Z CKP8dAlIA+cQ36EUZNB+W4Eb2ebIsxa0Ob32DDR/oZuPE4WDZvBMyl628K26O2ypDRDfT+ Iqz6MZTUbTgs8r+dWVNIdhXcCm7TcA7YgI/cQxPopQlUHQ8LUPU/zkJOSm4wc+M022gdVH X7RAPOdH0NUqzVGY5T+W3mZBP1wh8thAdp53wv71KqmuyuJVCrDGl7I5QSAHUvFO4bnURt LN55j1vGNw2bREkikC/HN0Ha214CPSZ6iNlfRPohBp1ak9alGNX0BOnawvGePw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681718951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Bh7I3HDrPo+//oWDymjnONVtxVeELt5F1rHHaav1vxA=; b=R5NSZu/m7HnuP+k7fvEJ42Et4yeqyZHOtezLCRoH4is1IMcYD2SikkNqcnxp1zO4dUCRVa Fu2rwIWfaKkkGnCw== To: Dave Chinner Cc: LKML , Peter Zijlstra , Valentin Schneider , Dennis Zhou , Tejun Heo , Christoph Lameter , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Ye Bin , linux-mm@kvack.org Subject: Re: [patch 1/3] lib/percpu_counter: Fix CPU hotplug handling In-Reply-To: References: <20230414162755.281993820@linutronix.de> <20230414162841.166896739@linutronix.de> Date: Mon, 17 Apr 2023 10:09:09 +0200 Message-ID: <877cub53ru.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: gmxkem8mncnstcfopacrknot6gkd39km X-Rspamd-Queue-Id: 8772C20007 X-HE-Tag: 1681718953-24775 X-HE-Meta: U2FsdGVkX18FPdLoGYorHeSrOwTDzmGtLtvomQw8FP7kAumHf4/TwEOl1p4xPix6AEkB8KUYbuofqoIY7BLhep7aBHBDd8RjfTzmFe7g84OLHZKGmauqkZILpVqeClyTIJ/oQGblKTsVDhq0TkqwvfzhRgOd7Msd3HN6LRutq+7ilZFPKJfrJTdSf55sJ9MxMlK8MMELsPr6uYnWy51G5PrVG3C5iksj/Ddt+KtpsNBLatapbqemzl2fU91wJ/fUyIXbOZeFHwlBv4hnJ+dr6E6QmGu21+FoXMHmBNvjm2rbOXVoQT3iDhbb2aAZK84NqF4IS/TAPXHs4PfL29k6tQk5axuK99z9K3/pTfaxWX1pEHN8b+ZWx7BJPNQ8VvoBrLS17Gd5hVjAXVSgtegvfl1p12vlJzbb8d0LRsmWt7SKN5DxpXBOwGEgVc/yjST642irJBcSV2S+O1Ij5piVQfYNhkxZBr6+c0CAlub0eT2m35DlG/2iHnjQXAXXgREp9wsWSh4EZ3rrZ7NohC2H/+HaMMKtaixnV8pfx3evBh8khnlaBse/GxkgRBeOyAeXv1L/r1ZITF9Hm7gvVr5Qr8yZwAeH9S9rCjOYPoBVK7ARTJAJG6vZPmLh8xCn3PwXjE8A67nHmRz/NXcQ8pftpvKJWT9m9rztkPYHZLPYcK8ugv8LrhgZCLrQMjKpAZFHnfJb3O0On3V1G6v8aPdl4PjSfWs2+u3HUZjJI/HHGOJTPNzFWPVfFxVDbTvH02Uze779XUS049op+5XxLC8aFZvr2/w0f/89aHB9Kuj7ExEzErqoJoEWla/cSRG+CkEyavSQCvmIXXlgfffmWb5EYSNUNieR0V9l99zBe4ivYHjFsYk2prmLUsRLPXqddXjUj5kvEMCs+TamPD6NJCGEGUMSR06jM0I3FjSmjGccv3ecmH4b9gXZX1SM0h+h1aWeWZfgQaWkmmM8BysnYKH +CUGV6sw IRfbzHY8kr+/nxjuNlV40998kcuNLLMDMQFG3ONEiRDoRh7zlkU7VZ0iHuRVGks+Qi0zz0GGYvITGWrK8VxoRAfiQYPW9EbhgOF3PlTI7i9lRc4Hj6MlMD8JLeUhs0xhQrcZACU4fOoXgAHyUXvAWkyBse2wMt21hEhFdPZY5Qa7/iwj2NEuigtwD1Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Apr 17 2023 at 12:09, Dave Chinner wrote: > On Fri, Apr 14, 2023 at 06:30:43PM +0200, Thomas Gleixner wrote: >> - percpu_counter_batch = max(32, nr*2); >> +static int percpu_counter_cpu_starting(unsigned int cpu) >> +{ >> + /* If invoked during hotplug @cpu is not yet marked online. */ >> + compute_batch_value(cpu_online(cpu) ? 0 : 1); >> return 0; >> } > > So this changes the batch size based on whether the CPU is starting > or dying to try to get _compare() to fall into the slow path > correctly? Right. That's not new. The original code did the same. > How is this supposed to work with counters that have caller supplied > custom batch sizes? i.e. use percpu_counter_add_batch() and > __percpu_counter_compare() with their own batch sizes directly? > Do they now need to add their own cpu hotplug hooks to > screw around with their batch sizes as well? Now? Nothing has changed here. Just the point where the batch size computation is called is different. The original code did it in the dynamic online callback late on hotplug and in the dead (cleanup) callback late on unplug. The external batch sizes always have been independent of this. Thanks, tglx