From patchwork Tue Dec 24 01:14:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JP Kobryn X-Patchwork-Id: 13919573 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 64247E7718D for ; Tue, 24 Dec 2024 01:14:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A7EC6B0093; Mon, 23 Dec 2024 20:14:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 756276B0095; 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 5A8A96B0096; Mon, 23 Dec 2024 20:14:26 -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 3BCED6B0093 for ; Mon, 23 Dec 2024 20:14:26 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0123F1C7BAC for ; Tue, 24 Dec 2024 01:14:25 +0000 (UTC) X-FDA: 82928080956.24.57A9FC7 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf24.hostedemail.com (Postfix) with ESMTP id 0E311180007 for ; Tue, 24 Dec 2024 01:14:18 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mG4H7Ytp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.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=1735002846; 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=WZJllDXeQ8qx4y4BNkUJ894lZbTAuhDCQMxQBXIE4qE=; b=jLDWKIRg4JmAaPv8RO9zGLnrTmW3hzWK6xRbf+e/m+Ku6OBQdd9FJ2EEG4z4ZlDUErPFe+ LwlO91wjWW09xXB6o4Na/ydqBgLQgbsLuXOTVfzMm9C8gRoJkX4ySyRzfQbws1KXObC42I fgKOpPrpINqSorBBHYi8bIe6wR7cloo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735002846; a=rsa-sha256; cv=none; b=nA+9y7QXXQn7ebRf4hVHPrqRSmlElgQ1EhYxxOsXTN1A2cmGnbFfZmlu7M8+8eFeL0pnvJ Cc8vsy3heI26qxFGJ1VZdtbRDz93BAmG65MRZQlrLHwctAYEgHs+TjSTKRX7NEuUr3gExz AOqMxBFKrPECI5Tpj2b6Lxrj6fDw+Ig= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mG4H7Ytp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-21670dce0a7so58505435ad.1 for ; Mon, 23 Dec 2024 17:14:23 -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=WZJllDXeQ8qx4y4BNkUJ894lZbTAuhDCQMxQBXIE4qE=; b=mG4H7YtpE4WYDyN4k2164ksiugFzBRl2F4Ru7zr25h0ytHYIoAlqtSlLjtg2a1T/wH vk0fbOzO51cIuu5yWngKkjEjc51VKfYcBxjnMxCk8sw3DNAywvm4qXhm136ZGvxP1WsZ AGe5XetILujFLXpAk7BFMLopz+9cyxvCh0ZKkOWZSn3J1eCVTgErQIIKdZbzcinTQyH/ 1/76F96BKSzPzjAASocJ9HSXID/FUNtxwEFrP+7ALlhaFKS4YMWWzffPi8UzY6xy6+7h 4sNau870HCQUI6TAYa8DNI8XKvwX+LbJK3kb1qku5F89PTu+3LsVoT/YAnWb8oL14MaS NAEg== 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=WZJllDXeQ8qx4y4BNkUJ894lZbTAuhDCQMxQBXIE4qE=; b=QCRa2rX1xO7GZUDecodO65ygwaVKSOBh0LGxlIC+7bTrhNdnt3FV+kv/ijoKMNHzez uHVxiarTsQUMh8+rGfEdNMUBt6juJV561dVcXv3IX9m8CRPz9hZ1P5rghsMi4tNATNkB J6w/7fwHyR4w/47fNwMwQIep+o37zl9Tn+hJMgbIiV4aaVRe9Q24AUW/WFxmYgpGJ5vB stOhbDbGvEZwf3+/9f3usfUnuVjlNi8yIHpkxrtV8Wtfo1fymiV6F2jcSHvZRY5GSHQI mpFD5Aa16n4gdVrppYx9jE3ucqPkRNkKAih7eNJ/b67s4k3hs7UwwEqzGJ/nyLZwni1w aNxA== X-Gm-Message-State: AOJu0YzrZm6fTM3KDmvQbHv0FPjQDIYCpN5ANNxKF15WSC/pGvHrUtHw ILpeAIPve8JhOnXW5WsD+ia4rfN1sqxdp3pzo8C4gTp3eO4OrkUCmFPUXg== X-Gm-Gg: ASbGncvyYiJ8Sj8+9y6syXvvlDAoGgQHkbkcC1ArZE6qeq4vTiopMSgOs5EYPT6/CY+ ReV69qLD8ANxFrUVqJfFSkb3VlhhEadA7hch1wQ7mRK+bUgruV6EIsHrGiNvOCEa1fGp03Yl7OF o/f687D+T/Vs4QwYFe+UjVKbNNPe+mzIT0ZATWNrwKh7d0yrnDV9UFmM/miN+rg3MutbX/WeDzE wOwR8NMxXXMn9s643cSBX/PSJ45LjCn3WdAWfP27Q4xc3JK9G9dL42DYkB7wyUdf+H1tIjLAsQi YgHHgAmrcKAYfJuqmw== X-Google-Smtp-Source: AGHT+IGzsv3KE6G8tMJp0bteEaX1XLhMudfBrUqQxMi2wOnR+qelJ6wcB5nC0ZJLnxdCo6AT0qqnSQ== X-Received: by 2002:a17:902:f685:b0:212:615f:c1 with SMTP id d9443c01a7336-219e6e9f98amr173127195ad.14.1735002862898; Mon, 23 Dec 2024 17:14:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 17:14:22 -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 7/9 RFC] cgroup: remove unneeded rcu list Date: Mon, 23 Dec 2024 17:14:00 -0800 Message-ID: <20241224011402.134009-8-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: znppoq1syeyiabacyc1zfppewhi6qc69 X-Rspamd-Queue-Id: 0E311180007 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1735002858-370240 X-HE-Meta: U2FsdGVkX1+2bRagmYFcFeEKMQF7ZV2b5AZZvPp51M7IjyoJ+egQq6cCjO1RXt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AMQylfoMrrgnf7LpScPQOwuuM1005ariyZ7Y9vmPcie+Vz9LZ1wdqXsqkI5si+DnrxkNOcghhrztCp1RjOKAjF0yUF/66begXIJpmhmwoP7en2KLw2jVtRmIoQm0kavGqSkbQGRg9+SZKgb/9KbuRxEBBR9mAeY12uKecIuSLmSDKPN2xX8NcLUHBbfGVQ/HTH9vXkHzkQect6rdEzC8WYJIG6A9FFaw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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 owns the rstat tree, the list management previously done by the cgroup 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 */