Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3655796rwe; Mon, 17 Apr 2023 01:11:57 -0700 (PDT) X-Google-Smtp-Source: AKy350ZK7wG0ii4whrY1nZLV7Ko5QQXnWUff4XKDskg40z+rTdMF6TwbNnxPo9EuM334uAZVqN69 X-Received: by 2002:a17:902:d4ca:b0:1a6:8527:8e0f with SMTP id o10-20020a170902d4ca00b001a685278e0fmr12353108plg.10.1681719117207; Mon, 17 Apr 2023 01:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681719117; cv=none; d=google.com; s=arc-20160816; b=Xj9uohJVdcOQFnH/SHeNzZNS0bfidit09AJAZzs3rGeX2MiKX8jLChh5zOZ6FJA2pb QS66iOIIWvlswOXNtP9ffqCsq4CQHGNgAMakBye4kDvwxS0HhkAoBwgk9czGkJB4cxXD gdmqVm+Z7aUEJ2tPSJ5sCcYwXIZPPxBh8SdXinG07P8HKXcvG6jfqSrHmH68y7J8bVDK HXKGu8yVaAUQ+M4UgNUQESZW3SCn4Gy5I/12GDcImCpqEPhcNoEknnLWBF4OiaqYTg1/ K8R6kxNuLPIjvueZhlsefn42LU7QsPd3PnpNgFUMFJVoMWAAUZLIGTl8hK27cPhcxt+I cyDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=Bh7I3HDrPo+//oWDymjnONVtxVeELt5F1rHHaav1vxA=; b=QfwkWzfrrHG4xUy3V0z0WwwjMIO1GapNeGQGcmj8BA6e8ENLiSJejayXrZjoySIKlN F5acPqZ4wfd9q37/N/yNd2roikb6JfFvw59/rpjlhBkDN262F4fuVwbPuyV0bXx4Wo0a Sp/JRXC+2CTY7dAOCq6MSbSD0g6xTN9bpNal1Bkn0pwbIb2PXXSCHZncZeuUoj8oMVDe qF9PFN4JbZhnuCiNsZhdHC1qZ+yCh3SrxeP+51Rab+cDUX11GeYwksCy+tpzpchCKgMa 3rIsWWz9VfPolqKA1/BOROWFdS5ivVc6IPaeM/1OdPJ7B2xoOxTXYAUvltkkHXJtaMl1 OaSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KYCGIgs9; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a170902a50100b001a6dc4a98f7si1794718plq.365.2023.04.17.01.11.46; Mon, 17 Apr 2023 01:11:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KYCGIgs9; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231174AbjDQIJY (ORCPT + 99 others); Mon, 17 Apr 2023 04:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbjDQIJU (ORCPT ); Mon, 17 Apr 2023 04:09:20 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00425585 for ; Mon, 17 Apr 2023 01:09:13 -0700 (PDT) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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