From patchwork Fri Jan 3 01:50:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JP Kobryn X-Patchwork-Id: 13925088 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 6AA51E77197 for ; Fri, 3 Jan 2025 01:50:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B267F6B0092; Thu, 2 Jan 2025 20:50:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD8386B0093; Thu, 2 Jan 2025 20:50:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9265F6B0095; Thu, 2 Jan 2025 20:50:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 696EE6B0092 for ; Thu, 2 Jan 2025 20:50:42 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 344DD140227 for ; Fri, 3 Jan 2025 01:50:42 +0000 (UTC) X-FDA: 82964459130.19.F346A26 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf03.hostedemail.com (Postfix) with ESMTP id 2BE6820004 for ; Fri, 3 Jan 2025 01:50:17 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TsjOGJkZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735868992; a=rsa-sha256; cv=none; b=MHfdqNBtNhLcTWub2ImQu8q0Isje6CdE2wGVAYeDtfoRKZ7KzDBomhlMTxTP50PFnuqbfK zMu7aE0xUqHvp+bYrzafStrB41BIUf2km2vmCmB9oRofAutj9rCOLdO4jEXjk0Qp+znuMG gofgMQroxlDCCZzS0uKCkrKFnNUyZaQ= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TsjOGJkZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.180 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=1735868992; 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=nf2FFJQYDlpZ583C3nSxd7LAcNPieUOkvWG4m0G9Q7oe3YzxoImSddL6N7diGad4bugu0Y Rl6zz96IDcgKA0qfwjOv7dJXmSoZwOLcS8lHpkCKBAypiOui5w4fp2KSNkIqkYggINebpk V0PiVHdgNutajQjpbHPD8gfwN5HQ9rU= Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2165448243fso196304565ad.1 for ; Thu, 02 Jan 2025 17:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735869039; x=1736473839; 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=TsjOGJkZG+ZH7k3AGNlOssTL+Pa9eQ7DHdDD6THN0XIL7CicgRBYQPxgpbUZtJ6T6p wEsLYlfCl59xSJlSLRoQeVbnujZG9qUWR3cRQ/rqdHjfQOMvLXTCfLewxOtYNe6CwFhQ xwsUW/ZCCeNQpthuarusKI1Cbddxghi60VUFv29qR5vIizL7HsV6vxGAPPV2uwU4GIYB r5rwPJszppCgMqQRBYl8KLIR9AEWrDrPhgiEDr7d9z5MPfpxVmEIq1nJFxAXuHGxrSUx CxiFW3pQsHbb2JQOtJhwVdOlJ/GtkdYOLcHyZLyZODHglJR+1TkdRNM0+/sFx8gq9+h2 eVhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735869039; x=1736473839; 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=G1MOYWScshmFFDl1SGwVe1IqgRCRte64CCUv/wctmjBpe0nUBS2lp8L41R7uwLzWz/ 8nHdA8eAIlLqrKLQdgNZagOTbsqGhU6tlWMrBamwbcfbJ3Wqi7s/rRH8uOGfosau2lCN 13XiZEstzPaBpqMO2wXHVRIeQGFc4JdZaTEhaDTkJv91t0DS60VQEkt/Z9nOY0J23fmd o649tEYRdF1gJQOfehrQQzkmrkLPv6So4Exsj336HsskyvzEl3prtvSaiepz+VVV6bFr Ai+8Otna+mUHaa3MVrXegCCkhtjVocOIZI1PyAH4pRUN6q1LWHODc4u4Vvj3slKVjrEl Vkfg== X-Gm-Message-State: AOJu0Yxjaq41DH22w/f5z+9MfkmfeK5djmHzh/1TAiyMXYbY+1rSxUm+ vCKI8jBvwc+viRJuNJM8zYTNNgTA14W0xAUhADvV69pDr9PIn2Tb X-Gm-Gg: ASbGnctHtPBJ/5lbM5JG62Wyic2k3pqqVuvSKmC+vPxo7P24YdYAXBJH2vzIug8oa6T JcolYM/IsgbySE9DSMnCVLM8OYRulp8p2SH80Aeb3auoAGbixX23JrcrLQ+/1zoSZ5HL2NmrISO X56Wci0RZ8ynv7LAgopydzOXpUWJrtVHyHY/X7RmnvHF0GCWeqSoppzPmrZpmvuVtbMvQujQFlo tMITDCsAkoQhSUcbTROHfgKl5N8psStC8POPf2pQFe2yShsJgO5hMGSUW1UK60zBuWS3A8SN4dZ dwO2uNCKZoJYvwZDOw== X-Google-Smtp-Source: AGHT+IHLu3wo59GI10fAuqab6yxqPVBVuB+WZNMyKnuCfl4ZNRDH7NjVsB8okoZW+Ytc6M8DT1bsCQ== X-Received: by 2002:a17:903:2449:b0:215:3a42:dc17 with SMTP id d9443c01a7336-219e6e8bbabmr593714305ad.7.1735869039266; Thu, 02 Jan 2025 17:50:39 -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-219dca04ce7sm228851505ad.283.2025.01.02.17.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 17:50:38 -0800 (PST) From: JP Kobryn To: shakeel.butt@linux.dev, tj@kernel.org, mhocko@kernel.org, hannes@cmpxchg.org, yosryahmed@google.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, cgroups@vger.kernel.org Subject: [RFC PATCH 6/9 v2] cgroup: isolate base stat flush Date: Thu, 2 Jan 2025 17:50:17 -0800 Message-ID: <20250103015020.78547-7-inwardvessel@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250103015020.78547-1-inwardvessel@gmail.com> References: <20250103015020.78547-1-inwardvessel@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2BE6820004 X-Stat-Signature: ewb4q8aepwpd8ggr61kokhw31uafmt81 X-Rspam-User: X-HE-Tag: 1735869017-106112 X-HE-Meta: U2FsdGVkX19CG2FG31uhYePXCnVwCUB+Solia+CZaN7D+Iudw6cjQNNNZMX/6GEeEE+gp8zgw+/m4mOrqyG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tS6Z4jI7IxREE2wtnHjJr5i+GR7GG2e8GzzMgrzTKzjiZM70l9Cyvk4NFRYCaauOntEfdt6cu6EEW0HjSL4prj/tWdKKVa25ogbO3hiOmiqDsZOs9nynOQ8qITehPLpfrRtSJXy1TYxP0+INVKb+bzs0cfpkVwHARqbm5bjgeY6rE11192EmsLIP0sUO75nFWG5QGQty1MzecFIFXt2OwwwcLCQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, 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); } /**