Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7567145pxb; Thu, 18 Feb 2021 13:40:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbvdRgKRDLbttsBlbBwJlp7xtY5QMIvcpsfPsd1x9wF7V/Lcfa2EAftKMn78FjWaf9ImKy X-Received: by 2002:a05:6402:2683:: with SMTP id w3mr5993182edd.378.1613684458578; Thu, 18 Feb 2021 13:40:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613684458; cv=none; d=google.com; s=arc-20160816; b=q2e2WycQABdrhUtXBqCQ9zVCAGdd1b5Nh9sDN8isYfKrbCvpZSggxg5wzgqMZqlL1A XOsmR5JOf4ZvJu3rc5OLuWYHGRnNELEs5EiozbeUjnI6sfsGhM6dhzBY8eivVbW7Ceq9 Y9fuDq4DFf8JGyYUAUNtEIQa19+5VwpXY0T4rn2OrPvQo/pTkivfTIFCs9k2H8e/wCOt MUpbvAlb2YNi/Mp8DAjX96P55csTZnqRPZZTD3zNOyObl2hdi8PsrUyKL2NKttjjcwqm hkAXSSoD2bPojq/js6cNyCKr4uo2KCDexRkGc1c6BJNC9ypKmDXRPcoXLVWc/tnnIKAY UDFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:from:cc:to :dkim-signature; bh=2qhkqHLunJIKhU1UVPTSw/3J2vDNCf42RfbxMLTGs9c=; b=QFcRhHnTG7MlCd+QjM5OlIeVH0Rbvsy61RwZzXgIjm8jM6y7/OA6OOXVtUypOSgZxa 4Z6Rd5nsnQ7P9sQOHj+iwLW0dPQOtvFDBVJXqy/+25pCDf6FHdGNlktbfbOB4ppRHmJF YoV5FWSv93flb4+fp/FYas2pe+LKbLqK0jWlsBtnPCETc5ms4CP9JJO6MX97iwKV27AD nNPktg73So9xu44NYoQ1GFdJY2EoT7NEMwJX5PFkYhwu4WrzLD1JIWWgNDmBoaah+NIE 5gwj5gh5keEGzCKtwcfyKBMI4Nk5E2vUgVGX4BLsW2pHJnwUEQCD/oPnQEfwx2/vC2RL BvsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=FM34Gd0T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk18si4148943edb.443.2021.02.18.13.40.34; Thu, 18 Feb 2021 13:40:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=FM34Gd0T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbhBRVh0 (ORCPT + 99 others); Thu, 18 Feb 2021 16:37:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbhBRVhN (ORCPT ); Thu, 18 Feb 2021 16:37:13 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC527C061574 for ; Thu, 18 Feb 2021 13:36:33 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id z15so2221593pfc.3 for ; Thu, 18 Feb 2021 13:36:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=2qhkqHLunJIKhU1UVPTSw/3J2vDNCf42RfbxMLTGs9c=; b=FM34Gd0TXiHd+m7+qwNzDE+I86tdeUPQXNlV4PKRNOqL29bpnR9WPXSPNqE9En33Cf Af8geQa9huwE9T/5BfHu/EtYjwdMFYfZAhsOd8nqGbBrfAopgRb3i0pPo+X54Rslnb5A rkbOM3E7FCLoCIeKQON3yprPbNMJbUiv8tk+ZutVSYUK9khqiZFi7jr8pEEssYpi0XE6 VWL6dqb30scZy9yn/MBNPA5WB+nGCNbfDsdKSoRUEc9fiZMPdtQwSDRZwQx6EfYtTUQN G4qYKIlt4sqD/1EEiqpMqItlFYO25PiaKLThlTDV7dq/tr97/1WQ+796ndOY+LrPsFZ3 aJ+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=2qhkqHLunJIKhU1UVPTSw/3J2vDNCf42RfbxMLTGs9c=; b=Mwhs93KOLbcR6ipN3HVNXUutcmtjn99+P1PeVg1/X3O2R/HzU8E6Eh3ZwPKeRIN6mo osCEmYe4wGeW8fyxptWs8E8j3psemSEIGIN7+CvXCsHitycn/vMT8gY2/3LjvoIJ6Gcu Mgdf9RHIQB/Ij5M+TQg4E4AeMONH9PLxBq8Fmk3bLNRWhngvZV7Re5Qx5ngbBpae8gZt E5jKcb8bSAC+IjQzo2OYtAJ1No4P3PbHKAll5LcjhqLmaXtaBxnLY3/25maJxFTSXG5L 3LB7G5QZfwrpHHXfZjiEJUoBTIfFc+k7itYvOBupRordpwXNy3QlFTgD3qljjEAESSDj udqQ== X-Gm-Message-State: AOAM531/Cy/8NqOxRjz4PYF3FYl9/86ZYpA/v8SalY9WeC9xb37Xc7fa UHKB7qzRRrlcn3PKiH2FP7pdnjBZBGtMpg== X-Received: by 2002:a63:eb42:: with SMTP id b2mr5721041pgk.284.1613684192983; Thu, 18 Feb 2021 13:36:32 -0800 (PST) Received: from [192.168.1.134] ([66.219.217.173]) by smtp.gmail.com with ESMTPSA id d24sm7605869pfn.54.2021.02.18.13.36.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Feb 2021 13:36:32 -0800 (PST) To: Andrew Morton Cc: "linux-kernel@vger.kernel.org" From: Jens Axboe Subject: [PATCH] percpu_counter: increase batch count Message-ID: <0bf90e07-8758-b238-b3f3-a330725a1134@kernel.dk> Date: Thu, 18 Feb 2021 14:36:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently we cap the batch count at max(32, 2*nr_online_cpus), which these days is kind of silly as systems have gotten much bigger than in 2009 when this heuristic was introduced. Bump it to capping it at 256 instead. This has a noticeable improvement for certain io_uring workloads, as io_uring tracks per-task inflight count using percpu counters. Signed-off-by: Jens Axboe --- diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index 00f666d94486..c3a9af5462ba 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c @@ -188,7 +188,7 @@ static int compute_batch_value(unsigned int cpu) { int nr = num_online_cpus(); - percpu_counter_batch = max(32, nr*2); + percpu_counter_batch = max(256, nr*2); return 0; } -- Jens Axboe