From patchwork Tue Dec 24 01:13:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JP Kobryn X-Patchwork-Id: 13919574 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 8D257E7718B for ; Tue, 24 Dec 2024 01:14:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED40F6B0095; Mon, 23 Dec 2024 20:14:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E5E896B0096; Mon, 23 Dec 2024 20:14:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C85386B0098; Mon, 23 Dec 2024 20:14:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A81346B0095 for ; Mon, 23 Dec 2024 20:14:26 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3B951121A11 for ; Tue, 24 Dec 2024 01:14:26 +0000 (UTC) X-FDA: 82928080242.01.6EBA587 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf24.hostedemail.com (Postfix) with ESMTP id 4E65C18000A for ; Tue, 24 Dec 2024 01:14:19 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hGeao8Jz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735002828; a=rsa-sha256; cv=none; b=QU5XzUn+3xBbYehJXXQ6aRjWIaZM4N+fItRLyCOsvyDP5jhqBCQKij+16QOdlr2n+imyxf yDvuy+oiiJHDJQKvbEJGbIdIDoaEvzvC2MLrZNAlNI5JwBukbQxxkzAN8o8Kf1nrCm5k/j AK5wvWuG35bmVhEZd6le7KIq4M0nUWs= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hGeao8Jz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735002828; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Ov79tpw4GuAmAWp+brDBEww96U26TW/4D2kYy+uPe/w=; b=6KUjhabN0y/WEJDOr38AVP4WFYRX7byPEVLWrvxINXP7SiV+54YH5J30ztARhb4deu/j5p q3crGcyBB5iL7H53p0UCITNh0w0hiL6Pb7juBnp55Ub4hxKVCyJgxmBLjnTAX2b6K3Q4/1 BsbgNhN+OZZWcimA0mozYk26N5hloFU= Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ee50ffcf14so4715973a91.0 for ; Mon, 23 Dec 2024 17:14:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735002863; x=1735607663; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ov79tpw4GuAmAWp+brDBEww96U26TW/4D2kYy+uPe/w=; b=hGeao8JzHgv+7IN8MD4e2I1zxj69Q7/5kg/1zbbCf1p7qAixSfiLmS3qWk74RM0hgm dg4EYIwc5IooxHbIPg4kzjMOyetlg2jkAPs2ehvu94YRVDlAs40IIjf1stnHO3MXFrRS vYtuv/FEHSgYvXHcs99J9WnOZFOTnQsT2nQWwTZOyhYUgUyRfK+Z/2V/S82epQZurhaS cxGvo8Xz2z6ky5a86K28QqsvALsXVYFLOOpL19m64FeGFU6Fgb4zmyeP2JKn0uH8iQ4s YqPBzCMAPo6kJIM1EyjFAFqwlKUS7GBmSOAQmEBcR2Z3mkP+ZdwuHb8vFXSgNh18FaEm JX3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735002863; x=1735607663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ov79tpw4GuAmAWp+brDBEww96U26TW/4D2kYy+uPe/w=; b=Im4inz6NXUGiLjTlp+X9xkazQut7BGs/apNJfBwgD9a8/PXS6A9NGyIGsYE46Ysr7c 7WBwEsPjZwCvKQ24efOqHnT4fBWJdCAUN1COjTrnmywzYZkTASpDiKjniF/LbXsWX+Hm wKiWEWUNuI1oUKM5UZ6258JTXMtaGOuCKQxB+n6CjyMUP4t85DpL2gHjExC2K7uiy66Q 9T+C6fxX0DtH88waI2GeDhWwpMIyp9Zczze9XuzFO02V5VVUCUp+Bqbh0gdH1Bk6sqQF xz2SN+N+zBzNPXnJGM4yuGyXO+thcDMWCU9L4v91H98jOxGneRTVKnb11vaVL1s6R6O8 Lunw== X-Gm-Message-State: AOJu0YzbEzGj3R++Wh9Uah2LC4DHKF4UqXBuy1YXbqX2PaQk+GSgYVOM ViIkN2ehflXpfBiJvMkri2pwz9qsfzCV/+9JHnZaRi8y93p9Tsr/6BmFcw== X-Gm-Gg: ASbGncs6enktv9LFenAAwGtFqptxJwmZq1GORQ/kNlQpSujGyzHv5Vns9Vwshn68UnD 0n3RwF5u9sc3Qh6FVh1dNAAEhqnfv3pwy+PRyIcPZK8MwxuTTiAITjEpAjlwpQRCbju9yDFjl5F oX3FFHFdaaO8XR+EvpWx77fKd7MFWDi3Oh8WweUQcSCKxk0uEl+cpdGRN8JEc942Dw3Fb0/Oveu HSq0BNA5lchkCecaHGWCNYg2svNq+9YxI6IRXjQ06vdyJXMOOeZU6JUqkPL2sZ7+cG8Qc5bQc2p S3DESfFO1J29xQWYqw== X-Google-Smtp-Source: AGHT+IEY86iGVikNx6UUKQVMCZN+fQ5IPsxtPbnuy3ffrZykI3u8eUI1nnnwBtZavbsacJHzUOJQqg== X-Received: by 2002:a17:90b:5251:b0:2f2:a90e:74ef with SMTP id 98e67ed59e1d1-2f44353f0b2mr28673142a91.1.1735002861637; Mon, 23 Dec 2024 17:14:21 -0800 (PST) Received: from saturn.. (c-67-188-127-15.hsd1.ca.comcast.net. [67.188.127.15]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc970c84sm79541255ad.58.2024.12.23.17.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 17:14:21 -0800 (PST) From: JP Kobryn To: shakeel.butt@linux.dev, hannes@cmpxchg.org, yosryahmed@google.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, cgroups@vger.kernel.org Subject: [PATCH 6/9 RFC] cgroup: isolate base stat flush Date: Mon, 23 Dec 2024 17:13:59 -0800 Message-ID: <20241224011402.134009-7-inwardvessel@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241224011402.134009-1-inwardvessel@gmail.com> References: <20241224011402.134009-1-inwardvessel@gmail.com> MIME-Version: 1.0 X-Stat-Signature: owfthxch556qz1rfpwasm5pz1nw1kzyn X-Rspam-User: X-Rspamd-Queue-Id: 4E65C18000A X-Rspamd-Server: rspam08 X-HE-Tag: 1735002859-74985 X-HE-Meta: U2FsdGVkX1+ersnec6vCpn1OY33zrWERxV4OhfTpflrd7lunztd4lScNGCG7ZrEjY5ZemwICOmhi1efuTbpILlRvh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kV++790WzxzYHa8lUqDjsPMf/66tiwjJesZMHErLOUtutqFxMqbLh4cqSSBJXE0wn7A0R6eMsYtOdkRZe5LMCI/QuHNUb2v0o9O54EiA9uQTCNpg9ZM02HF6zFLIDwACXqz08M5BlpOv3/BHiVc9A8Zpatr1LlkR9qxHYQhcHvf/q6CVlSEqe62C7iuIafCF2K1bhw== X-Bogosity: Unsure, tests=bogofilter, spamicity=0.463905, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Remove the base stat flushing from the generic css flushing routine. Provide a direct way to flush the base stats and make use of it when the cpu stats are read. Signed-off-by: JP Kobryn --- kernel/cgroup/rstat.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index 958bdccf0359..92a46b960be1 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -320,6 +320,14 @@ static inline void __cgroup_rstat_unlock(struct cgroup_subsys_state *css, spin_unlock_irq(lock); } +static void cgroup_rstat_base_flush_locked(struct cgroup *cgrp) +{ + int cpu; + + for_each_possible_cpu(cpu) + cgroup_base_stat_flush(cgrp, cpu); +} + /* see cgroup_rstat_flush() */ static void cgroup_rstat_flush_locked(struct cgroup_subsys_state *css) __releases(&css->ss->rstat_lock) __acquires(&css->ss->rstat_lock) @@ -341,7 +349,6 @@ static void cgroup_rstat_flush_locked(struct cgroup_subsys_state *css) for (; pos; pos = pos->rstat_flush_next) { struct cgroup_subsys_state *css_iter; - cgroup_base_stat_flush(pos->cgroup, cpu); bpf_rstat_flush(pos->cgroup, cgroup_parent(pos->cgroup), cpu); rcu_read_lock(); @@ -408,7 +415,7 @@ static void cgroup_rstat_base_flush_hold(struct cgroup_subsys_state *css) { might_sleep(); __cgroup_rstat_lock(css, &cgroup_rstat_base_lock, -1); - cgroup_rstat_flush_locked(css); + cgroup_rstat_base_flush_locked(css->cgroup); } /**