Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2671347lqp; Mon, 25 Mar 2024 06:17:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWGsvrecgSaa5Mq8q0g8wsS2yXRzrJHRUl6vSWd6v0zV57qEN4Q7oR+jAaURHH4SRxTinMg5BFJm089aOLPRxY63hkv8owsT7LlyI/95A== X-Google-Smtp-Source: AGHT+IGnUAG4YkgRsHo5oNtY9tHk/fggsSlurMjgYfc6giGGImAhF1ItZnBxP2qbiWkHKuwmqd5G X-Received: by 2002:a05:6358:480d:b0:17f:59c5:1343 with SMTP id k13-20020a056358480d00b0017f59c51343mr7822148rwn.0.1711372623575; Mon, 25 Mar 2024 06:17:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711372623; cv=pass; d=google.com; s=arc-20160816; b=H5vGoE2D46e2qqN2Ut3mukpugkPzROx+zTxSWtqoGaCrik3xpFXlGoDC7NtqSr48Dv M1N4lKx/L2ane+vod2bM8wLFS2nLRqbnrMN/4kKys4JfNez43rOoMJNFxw1n31NXo84G dX/QBXOEpiBjY02MKSE1lNNpXrY/PnuFIdUoU7z5GrBjRCyk0zqjdlbPsYDHH4ULFp23 AdlgJFWN0jY7IDT2UrXfzn92Okc9+jrVBecQkgcFXjPbBnavg8xGTYdFIYxT1GUx2V8n 3A1W/cGxsWVk18v0HAZ3tb5AJZUv0clHeZVvbep3wLu8az1RKI7h6cuIAjLsNad3Fwba 2Uzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=5LK/uROjNuLUPEBcVMSILK0df5fxwLC3iKaVO0oN2P8=; fh=bGIkBri2WvgWyfiVrudtnK12RpPyQYqV2N4qvSprdK8=; b=Sv7RmxxC+Q7MIOxIHP02FA5goUp5bj92DmgeOyKPj3hB78gqwpv1FPfiatfJbbLihs krvxgOq5TmEvCu/cCPEhIpnHBRklNZxPkXm2+IakTtr955SVIG7egNQrJgR03cFwa0w0 LRoaLXcWJeL/d4J787V/rUlz0Wt1gRgcLPjQzEPuSiGkhD3m5lfdC5jju7asGI0WAqVd 4eDuADxfdK+GiCFz8k0CzlMWc6FL1Phvnfi/ZpzNIVl+OJftQLeumweTRZQhc3OnBOFb gVL3mZ86yN+mKn31Z6i2FpEg7HdGc640lhIG1sgNcg29WKPrdOzMj+0rbpmSRR5vFMOw /Qpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-116463-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116463-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a12-20020a630b4c000000b005d9b49b7abasi7564935pgl.846.2024.03.25.06.17.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 06:17:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116463-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-116463-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116463-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E35E0BA02DC for ; Mon, 25 Mar 2024 12:27:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04C12136E18; Mon, 25 Mar 2024 07:31:49 +0000 (UTC) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C442187655 for ; Mon, 25 Mar 2024 03:44:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711338271; cv=none; b=ShE6vL3z0ev5QpvsYL4gB3i8zAd3NHBXHnyFxyV/OroehoLuECooTbWqAfEGZbN4wYukmMIxnbGVknGgCPdozF4f0BZN+N2Gp6oI5G23A/Shfno1+2zp7iGV1Z8pvl+TGsoDxCy+0iVcCHWVJr30RLEV3XAUav8sr0F+K25rgt4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711338271; c=relaxed/simple; bh=sgje5sEOE8XBsmqgTdTVqNM6zkfECGgBmoRAE8rZUYM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=gpbiVyQ/fPMfWj/W+0Bt0XT/8Dlp2pvsPNcwaAC+nAFiDEYJ9lW21oXyxn5cZSIdhsKwe6WsTD7kSPIZs3Nr2hb3etqPxmqJRJJUPL1r3Akd0rSkt1gDbMH/F9hDcbY9OAyrbV1bK0qZgJDz0bpyXPpUscr2YZN4dPn0O3a6I90= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4V2zJv5Z4QzNmJC; Mon, 25 Mar 2024 11:42:23 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 33006140F7B; Mon, 25 Mar 2024 11:44:22 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 25 Mar 2024 11:44:21 +0800 From: Kefeng Wang To: Jan Kara , Dennis Zhou CC: , Kefeng Wang Subject: [PATCH] fs: quota: use group allocation of per-cpu counters API Date: Mon, 25 Mar 2024 12:12:40 +0800 Message-ID: <20240325041240.53537-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) Use group allocation of per-cpu counters api to accelerate dquot_init() and simplify code. Signed-off-by: Kefeng Wang --- fs/quota/dquot.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index dacbee455c03..808544f74e5e 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -3016,11 +3016,10 @@ static int __init dquot_init(void) if (!dquot_hash) panic("Cannot create dquot hash table"); - for (i = 0; i < _DQST_DQSTAT_LAST; i++) { - ret = percpu_counter_init(&dqstats.counter[i], 0, GFP_KERNEL); - if (ret) - panic("Cannot create dquot stat counters"); - } + ret = percpu_counter_init_many(dqstats.counter, 0, GFP_KERNEL, + _DQST_DQSTAT_LAST); + if (ret) + panic("Cannot create dquot stat counters"); /* Find power-of-two hlist_heads which can fit into allocation */ nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head); -- 2.41.0