From mboxrd@z Thu Jan 1 00:00:00 1970 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 EB9CBC36000 for ; Fri, 21 Mar 2025 17:22:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D44DE280002; Fri, 21 Mar 2025 13:22:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF52C280001; Fri, 21 Mar 2025 13:22:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBDA5280002; Fri, 21 Mar 2025 13:22:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A29A9280001 for ; Fri, 21 Mar 2025 13:22:50 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D4207160422 for ; Fri, 21 Mar 2025 17:22:51 +0000 (UTC) X-FDA: 83246228142.29.DC232FF Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf20.hostedemail.com (Postfix) with ESMTP id B681B1C0002 for ; Fri, 21 Mar 2025 17:22:49 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=GND+zSt6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1742577769; a=rsa-sha256; cv=none; b=qqnG9A9bhcJ03r5hdmOgSPLJoxtdyevDWUVpp1RQgkGW7jAHgUOFIbnCzwdZ00+q7+v43J Paa4yAZyQrgkXY7Ug6gZmOypXE4ETl5EOJWQmb0xsCWjJqXAy2STeV2L/fKguB69mKhL26 V4IL85rgoDPtyFPQ1m7Ese1GM/r8fok= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=GND+zSt6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.182 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=1742577769; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nfP6U3mgV85kFoAvAm6siMg5qzkBJgkN5hQA1TPZNs4=; b=vFzJKJbbjr8pW19sdrTpYuKDPwhYwGqB4HL/UDjbh92FaWdzvST/uVvyuw1n2ckhKMufnq y+ysvUhxHIogWBgHMX0bwdXUiqylkWGDkaMOyieS5GxSfP71/UVdEomQnuNaTzphmOcBpN YVWos2T3LzCm3gU1W9sQJ5aZasPGR58= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-224341bbc1dso47039505ad.3 for ; Fri, 21 Mar 2025 10:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742577768; x=1743182568; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nfP6U3mgV85kFoAvAm6siMg5qzkBJgkN5hQA1TPZNs4=; b=GND+zSt6EXtX0KEOSUYNJ2K58MGfY2oI0AiFTPkId4qQLhFjTiGh9NOWGDt3l3Psp7 rTSIKqg6/D7qo5H77KwXPR/kK1fPIeCmkAKjnwXBcTYbeytyPi7r2zTxo7z+fY9Wkgny kEMpI8FtuPRvdiBjR9n4s3XkSEqYKFCppPAlY9PdK9XkeUsCgSt3+NUfVVCSe7CTyXdG rk902/s3WJs1txYgb42m8TCo/mUtJqC866jOSrgLS6ig24hN+gTVR7HCh7oo5d71/a+J AdYb9cheH7YZmaztfONUZY4zWGq62FRMNIkE9QuFoGL+Q9RHp0wPKQbgXWnS4xfXg2cU VacA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742577768; x=1743182568; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nfP6U3mgV85kFoAvAm6siMg5qzkBJgkN5hQA1TPZNs4=; b=FHKRS5sr9q8pDV6yUwTYzwULuRL5exasebAajbDS23B39ezx78iiU5bCbZ+d6fxJb7 a8xfUlLIAYkWFukDTPgSUSASEEfOSMv1HqrLxDfPJKAJe5TA7r/4O6c+45uXnFfFbpRq cvUp/LN70/MjfjVhGtag9eFT3R6Y8lXDW2HJmB99sPZAd1C1dBDFh1rwjBIcLt51ym/V UbtZnU8fnfoN6hrwThMBS0OirZCK8ue0eREQv/GherFAOUFL2VsOJmdn52/AzAz6k6y/ tG8NcXJonCa8zV4mgqT5f74Qe0+dFXUXZcY6vHTdNwCaTbxc2v9jnaN9PAgXitq2Jlcs NSBg== X-Forwarded-Encrypted: i=1; AJvYcCUKnsCVrydysOYviJ1a8ta+SipNMv+KqNugy+KkjV0MFYGVvC7IGufMXbYey1AVLgZLGHj57BZXMg==@kvack.org X-Gm-Message-State: AOJu0YyN5RUCcRr6GqvCfNmWFmtq6ge+nbYZYLogKRCbZ/r7mHqpsQs8 XGUtf06aMlinLSkZ/sCsSHwhsSrTpUN0MvYjR+e9TMuaCGtyniOJ6L/Fcg== X-Gm-Gg: ASbGncsFuQi7WIjBBbPxCPmVv4v/lz38Y03DeX+sADShSzED7RKfW9ETbK+mmSeQR6O SaPJBQgRXySfxxedE8enbBPhylLXQeM7A11TytViDkJEefROoo4E+6UoX3LRYtvAW64SzkDzAwT KfwDk5wTLNwXznWGboVeOAlenkBAvEHLmXphlniWy6eyorSkoYfMxFzr5xMJEnZ4Q5ECbXGla3/ d53NcYIQb1PpTW8UHDqCxgcwzbsXlr3QGVFXKu857I6+AJ9wCA9S6pOCKFkTjHSoDpr+nBRkcAE zlxpqj7+mQ4Ckq1D8Vjlwm/3OLbZp0vmuMdZazYj/MBaLtDBgn5U/cbVqximCUUnRm/xoBYqL41 o4v83p+jlaxOZ9g== X-Google-Smtp-Source: AGHT+IHdDvQCOplIOOZk2IKKjSOEAGx+zJFtXl2LyOAG2LXi/zHVe98h9cBlK1UbjthAaNMpAVmR0g== X-Received: by 2002:a05:6a21:6e03:b0:1f5:6b36:f574 with SMTP id adf61e73a8af0-1fe434371cfmr8434769637.38.1742577768209; Fri, 21 Mar 2025 10:22:48 -0700 (PDT) Received: from [192.168.2.10] (c-67-188-127-15.hsd1.ca.comcast.net. [67.188.127.15]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4e5d5sm2035615a12.67.2025.03.21.10.22.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Mar 2025 10:22:47 -0700 (PDT) Message-ID: Date: Fri, 21 Mar 2025 10:22:46 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/4 v3] cgroup: use separate rstat trees for each subsystem To: Tejun Heo Cc: shakeel.butt@linux.dev, yosryahmed@google.com, mkoutny@suse.com, hannes@cmpxchg.org, akpm@linux-foundation.org, linux-mm@kvack.org, cgroups@vger.kernel.org, kernel-team@meta.com References: <20250319222150.71813-1-inwardvessel@gmail.com> <20250319222150.71813-3-inwardvessel@gmail.com> Content-Language: en-US From: JP Kobryn In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-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dch3253+ FrTzL6/o xScznDECiWI9tvENadwYd0zV2U/qWHhgHA3CPBcoH/A0AcjMqHcioImNTMTVsNx1KbayuyyfQSIih61Cy8xPKs4/xGbcB1kpm1Y5Pxt0td8HEw1e+ZOWbqw0iVQW9/DwnkiN2g5ytEbBN9uJ9ENC645BPXqXrtMgmXZ0iRXrgfYTAe36nsFV1fZgqFsLHf/dcJef85eLbl11uGD28eC0N/76pmVGFD11iRJ23WQaC65AODtsporEgBiKcp7lkSehfKJIZgOBwyhTVyHNeAYrizks3hhZ3eXv1Gm58Z2F4k/5/teoGXk7zStYPPUJIVKXYDFGg64bbQvCvHA9ueNwJkKRApdtTIRfSnRNl08MpJr6oBhzynyHh+3+b+elAE5YyCO4gBuZ2o7PYjOJfiRrGg7/5Tw== 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: On 3/20/25 2:31 PM, Tejun Heo wrote: > Hello, > > On Wed, Mar 19, 2025 at 03:21:48PM -0700, JP Kobryn wrote: >> Different subsystems may call cgroup_rstat_updated() within the same >> cgroup, resulting in a tree of pending updates from multiple subsystems. >> When one of these subsystems is flushed via cgroup_rstat_flushed(), all >> other subsystems with pending updates on the tree will also be flushed. >> >> Change the paradigm of having a single rstat tree for all subsystems to >> having separate trees for each subsystem. This separation allows for >> subsystems to perform flushes without the side effects of other subsystems. >> As an example, flushing the cpu stats will no longer cause the memory stats >> to be flushed and vice versa. >> >> In order to achieve subsystem-specific trees, change the tree node type >> from cgroup to cgroup_subsys_state pointer. Then remove those pointers from >> the cgroup and instead place them on the css. Finally, change the >> updated/flush API's to accept a reference to a css instead of a cgroup. >> This allows a specific subsystem to be associated with an update or flush. >> Separate rstat trees will now exist for each unique subsystem. >> >> Since updating/flushing will now be done at the subsystem level, there is >> no longer a need to keep track of updated css nodes at the cgroup level. >> The list management of these nodes done within the cgroup (rstat_css_list >> and related) has been removed accordingly. There was also padding in the >> cgroup to keep rstat_css_list on a cacheline different from >> rstat_flush_next and the base stats. This padding has also been removed. > Overall, this looks okay but I think the patch should be split further. > There's too much cgroup -> css renames mixed with actual changes which makes > it difficult to understand what the actual changes are. Can you please > separate it into a patch which makes everything css based but the actual > queueing and flushing is still only on the cgroup css and then the next > patch to actually split out linking and flushing to each css? Sure, no problem. I did something similar in the RFC series so I'll apply again here. >> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h >> index 13fd82a4336d..4e71ae9858d3 100644 >> --- a/include/linux/cgroup.h >> +++ b/include/linux/cgroup.h >> @@ -346,6 +346,11 @@ static inline bool css_is_dying(struct cgroup_subsys_state *css) >> return !(css->flags & CSS_NO_REF) && percpu_ref_is_dying(&css->refcnt); >> } >> >> +static inline bool css_is_cgroup(struct cgroup_subsys_state *css) >> +{ >> + return css->ss == NULL; >> +} > Maybe introduce this in a prep patch and replace existing users? Makes sense, will do. > ... >> @@ -6082,11 +6077,16 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early) >> css->flags |= CSS_NO_REF; >> >> if (early) { >> - /* allocation can't be done safely during early init */ >> + /* allocation can't be done safely during early init. >> + * defer idr and rstat allocations until cgroup_init(). >> + */ > Nit: Please use fully winged comment blocks for multilines with > captalizations. > > Thanks. >