From patchwork Fri Jan 3 01:50:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JP Kobryn X-Patchwork-Id: 13925089 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 E6837E77197 for ; Fri, 3 Jan 2025 01:50:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 50BC46B0095; Thu, 2 Jan 2025 20:50:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B9256B0096; Thu, 2 Jan 2025 20:50:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30EAA6B0098; Thu, 2 Jan 2025 20:50:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0F4A96B0095 for ; Thu, 2 Jan 2025 20:50:44 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BB57D1A0153 for ; Fri, 3 Jan 2025 01:50:43 +0000 (UTC) X-FDA: 82964459970.23.C3931CE Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf17.hostedemail.com (Postfix) with ESMTP id 0B46E40015 for ; Fri, 3 Jan 2025 01:50:02 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=EdRf91tz; spf=pass (imf17.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735868989; 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=z0/95vxHq4AbTjjm1qqTnNQIEsjcgRpvj31jjZiEdxU=; b=c6jGSRQXRupSNZ0fBaTF4x1s8m8j4MJwQ8qx4Y1OyY/fNWqnrIaQ7TkcaKxrSo2K63gfeA 7tRs+dmVawBM1Ak/lAln0gbsv568UTDD3F6X/8BTex7K2YJoa0tvElYgQry8QaZqV48FOu V/s+9bvqfCy2MRaKxqB4KQ2qH9YUO9A= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=EdRf91tz; spf=pass (imf17.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735868989; a=rsa-sha256; cv=none; b=I5u/veVFjalsMrkKaCKZyz7kyxxAAZfWlIS7Ae+AaioD3xn2SlYSOYFFWcd4gcxHl0zyL8 JFSlXvCd9BEMcPhbxNTRw5h7NNnARDuN0pCkYfnP1loTTdSg+ogQ5XVKmbZnl+fAhZBojB vsaJDVrQ9908Wci3zuVvxaEJ1R28eIc= Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-21669fd5c7cso165407305ad.3 for ; Thu, 02 Jan 2025 17:50:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735869040; x=1736473840; 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=z0/95vxHq4AbTjjm1qqTnNQIEsjcgRpvj31jjZiEdxU=; b=EdRf91tzTAyxKeQRWiPNaCWMTVrI4i/F8iiOLMR3dmm8ttJIp5C++MIghqa02q4K0c klQq9nGavUuLIB1c9CbRxWaxa3JTGB3WG/3r6vlUBjpk7Kds1vvhnnGJx4mqSmhhkxMA j21YcLF7T4f5TXnYEA75ktr7GDMe0aupdVAwfhz0xWvc0RSfyYzFkGnGGYO0IDg4HNEt YDAi/rnqGPVqbhV84QatKFTL4kPiVT+m12M1hu8xWw/ZbZdJtPNOF+dHFWm3jgCdfGrZ zr1HhAYY/qx7dqoJFE717Scalih7OCk50lgVCqQD7jCz/4WExD3FT4iy1AqDaRvyCvKz AVvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735869040; x=1736473840; 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=z0/95vxHq4AbTjjm1qqTnNQIEsjcgRpvj31jjZiEdxU=; b=EOrVmsB3mY4O7UWPo2f01rGhtr4/Q/2dqyzB5V5Uq+oxwizZFnUnP0PaCrZfL3GrDG g9Veub75A2oFxkyk7dGN37bAeGi5S/0QwS4yS+6kjO29PFa48GXSDzQ+WcOzA0q17YSs BHyLG/rrTu/o7QPsrtfv4fyAHrdlKcdorpOJpOArD1dOUAt0w3oHqti5SI1Q7CwcmmnS to3MXcAmPEG3cp4sUVZrVvj+KNBQR/axvs+nFfiJ1vxlsesjSCslw2jZMV6mYg4jauO8 xgt9qO2R24YboVi4CfBxCYbW36rzar0Kq91DJzng7YBRhuRaXlWpS2f0SBBYhperpiP6 LnmA== X-Gm-Message-State: AOJu0YxBgOOYbS3BXSJOYPlNUTTxO+4ItmNjBYOofmj2ohWK/4uxK/ye rme1LN4LjVrrBocCGwkTek8oxxLvARDz6z5bogPc+j5LtIGHSUg8 X-Gm-Gg: ASbGnctlcixOQpK7PsgOzyASzcYSrhslo8x2aPQMrob1pu+Sh8pwTolm7xnIyVaGyF9 n26RzNthCMlrX4k4sRW8wRQPTg1IJiNjRWovdgYgx0F1qZyc4i4GnRzOyjM5dRrAe6dkO0UhzWV Ka15D1iXnOXqtrqnTXba2DdcGCv98RTrEfSDgfLNd7I0XySnC7vcAtBPkwjEyrj3QJzHtM0r95B 0vN3QyeX1UvSbXZ2oQxzF4D3AhV22Hv4sz6wKPBJ89u/PwetN8bTL4Qj6lwUob16IufYdoYcZgK ZynH/931YPVg0IfY5w== X-Google-Smtp-Source: AGHT+IHpW6kPJoz3uQ31McNNuWFPISD9A55LMmIKwxPMCRkUhBP25MkbHaNyVJ9vNwtjAbpRrI4k1w== X-Received: by 2002:a17:902:f64b:b0:216:779a:d5f3 with SMTP id d9443c01a7336-219e6ea1c00mr709992435ad.14.1735869040635; Thu, 02 Jan 2025 17:50:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 17:50:40 -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 7/9 v2] cgroup: remove unneeded rcu list Date: Thu, 2 Jan 2025 17:50:18 -0800 Message-ID: <20250103015020.78547-8-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: rspam06 X-Rspamd-Queue-Id: 0B46E40015 X-Rspam-User: X-Stat-Signature: 9zjg58fh4r6ukhqxj9xe1txwaty8up4n X-HE-Tag: 1735869002-42385 X-HE-Meta: U2FsdGVkX19OVTzjPxafEB6P3gmE1xSN5GnVpe44FPoGVgA+TRpqiOleR4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IpT2nozpTJbNLEFOn/tzGhiqxyzHarg9s28id2CabRTIjNwZ+UN1zJuS17j1CZShl2pL0glT8nsf4SqutMR3wMkPmuEjLbRpund9zUAfWA11CnYZrhJDDsjRcnjlFqtxfOccXDKVb9QluUFKm0Zv9KFfI168AjbkfQkGay+j9AGbLj8UBHivkyjyiQ/rPJip0AZjToHT/2GsN7EhX2g2k8/+3sJw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Since the cgroup_subsystem_state now owns the rstat tree, the list management previously done on the cgroup to keep track of which subsystem states are participating in rstat is no longer needed. Signed-off-by: JP Kobryn --- include/linux/cgroup-defs.h | 11 ----------- kernel/cgroup/cgroup.c | 20 +------------------- kernel/cgroup/rstat.c | 9 +-------- 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 4d87519ff023..836260c422a0 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -182,14 +182,6 @@ struct cgroup_subsys_state { /* per-cpu recursive resource statistics */ struct cgroup_rstat_cpu __percpu *rstat_cpu; - struct list_head rstat_css_list; - - /* - * Add padding to separate the read mostly rstat_cpu and - * rstat_css_list into a different cacheline from the following - * rstat_flush_next and *bstat fields which can have frequent updates. - */ - CACHELINE_PADDING(_pad_); /* * A singly-linked list of cgroup structures to be rstat flushed. @@ -198,9 +190,6 @@ struct cgroup_subsys_state { */ struct cgroup_subsys_state *rstat_flush_next; - /* flush target list anchored at cgrp->rstat_css_list */ - struct list_head rstat_css_node; - /* * PI: Subsys-unique ID. 0 is unused and root is always 1. The * matching css can be looked up using css_from_id(). diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 96a2d15fe5e9..a36ed3995c6f 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1826,7 +1826,6 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask) struct cgroup_root *src_root = ss->root; struct cgroup *scgrp = &src_root->cgrp; struct cgroup_subsys_state *css = cgroup_css(scgrp, ss); - struct cgroup_subsys_state *dcss = cgroup_css(dcgrp, ss); struct css_set *cset, *cset_pos; struct css_task_iter *it; @@ -1864,13 +1863,6 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask) } spin_unlock_irq(&css_set_lock); - if (ss->css_rstat_flush) { - list_del_rcu(&css->rstat_css_node); - synchronize_rcu(); - list_add_rcu(&css->rstat_css_node, - &dcss->rstat_css_list); - } - /* default hierarchy doesn't enable controllers by default */ dst_root->subsys_mask |= 1 << ssid; if (dst_root == &cgrp_dfl_root) { @@ -5491,11 +5483,7 @@ static void css_release_work_fn(struct work_struct *work) if (ss) { struct cgroup *parent_cgrp; - /* css release path */ - if (!list_empty(&css->rstat_css_node)) { - cgroup_rstat_flush(css); - list_del_rcu(&css->rstat_css_node); - } + cgroup_rstat_flush(css); cgroup_idr_replace(&ss->css_idr, NULL, css->id); if (ss->css_released) @@ -5569,8 +5557,6 @@ static void init_and_link_css(struct cgroup_subsys_state *css, css->id = -1; INIT_LIST_HEAD(&css->sibling); INIT_LIST_HEAD(&css->children); - INIT_LIST_HEAD(&css->rstat_css_list); - INIT_LIST_HEAD(&css->rstat_css_node); css->serial_nr = css_serial_nr_next++; atomic_set(&css->online_cnt, 0); @@ -5579,9 +5565,6 @@ static void init_and_link_css(struct cgroup_subsys_state *css, css_get(css->parent); } - if (ss->css_rstat_flush) - list_add_rcu(&css->rstat_css_node, &css->rstat_css_list); - BUG_ON(cgroup_css(cgrp, ss)); } @@ -5687,7 +5670,6 @@ static struct cgroup_subsys_state *css_create(struct cgroup *cgrp, err_list_del: list_del_rcu(&css->sibling); err_free_css: - list_del_rcu(&css->rstat_css_node); INIT_RCU_WORK(&css->destroy_rwork, css_free_rwork_fn); queue_rcu_work(cgroup_destroy_wq, &css->destroy_rwork); return ERR_PTR(err); diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index 92a46b960be1..c52e8429c75d 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -347,15 +347,8 @@ static void cgroup_rstat_flush_locked(struct cgroup_subsys_state *css) struct cgroup_subsys_state *pos = cgroup_rstat_updated_list(css, cpu); for (; pos; pos = pos->rstat_flush_next) { - struct cgroup_subsys_state *css_iter; - bpf_rstat_flush(pos->cgroup, cgroup_parent(pos->cgroup), cpu); - - rcu_read_lock(); - list_for_each_entry_rcu(css_iter, &pos->rstat_css_list, - rstat_css_node) - css_iter->ss->css_rstat_flush(css_iter, cpu); - rcu_read_unlock(); + pos->ss->css_rstat_flush(pos, cpu); } /* play nice and yield if necessary */