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 DBCC3C3DA4A for ; Wed, 14 Aug 2024 09:00:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 64C086B009F; Wed, 14 Aug 2024 05:00:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5FBD86B00A0; Wed, 14 Aug 2024 05:00:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49C336B00A1; Wed, 14 Aug 2024 05:00:23 -0400 (EDT) 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 2A6A36B009F for ; Wed, 14 Aug 2024 05:00:23 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 62C3D120D6C for ; Wed, 14 Aug 2024 09:00:22 +0000 (UTC) X-FDA: 82450254684.29.DD98254 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by imf27.hostedemail.com (Postfix) with ESMTP id 5979740029 for ; Wed, 14 Aug 2024 09:00:19 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=W9LGK1fW; spf=pass (imf27.hostedemail.com: domain of mkoutny@suse.com designates 209.85.128.43 as permitted sender) smtp.mailfrom=mkoutny@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723625984; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MYn3EAWwM4yksejs7G7ely3yb9R9FB21TAMqGrL5nTo=; b=B/g01d3iZGlSIaN5IIPMJ1hP+R01jk/Tkenc/XaqxosiMRJLy6QJ4tjXdU14lZ8EV8P+lz El0sMhu0Ir6uKtvHhGTSg/7EM/v3rNDSsKjJxcorGNIC7uz4CL91wfR0k/+lzBjYHWJMTN 5uLH94b+h/pZdxwfkAxKPluDUrjd1kM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=W9LGK1fW; spf=pass (imf27.hostedemail.com: domain of mkoutny@suse.com designates 209.85.128.43 as permitted sender) smtp.mailfrom=mkoutny@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723625984; a=rsa-sha256; cv=none; b=OOIDrToNZGP6QhEYG05tkSHcx2kwtzD6iz+a3J7lqZgDfw9nDoCL6oSaG1UXMz17vgbiw7 1vYwz5r7CkYEBmP2lGe76/d38EzvpMNMoUa4o+jPq2YvW6wPjadMvUKrlOu9AMqEt8OAj5 fCAN6nzYNt/+z39rwFtZlwt8Ty5ZxOk= Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4280b3a7efaso47242785e9.0 for ; Wed, 14 Aug 2024 02:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1723626018; x=1724230818; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MYn3EAWwM4yksejs7G7ely3yb9R9FB21TAMqGrL5nTo=; b=W9LGK1fW7goeRmcIMuS2US5c1dshi1mq7ZYAg+xXt253DlUu+fog6OX2duKnSJuz+H jFHkpn4lSm9a4VgiiH5IJOTDZ8n1fTvhpeDviJmR2mjcUZ7s8Lma8qfXmptWeTGN4GKP xKUBHkOxjG32+FOu62pnk/tOkuBPnewVFAsJ/vf8U0e2HYs8tMuek372WroRLNc+MESF EAHIFqXa3zqlAMr2sOMJEi7pGHcme49zX2AUxYMyIjEv23wl10X7lBk4h4jrDr/C8Ffh hvahoz7qYeDFb78ZAouTOZZzKk5kaSctGkoN2jR6GUcIApRM6JxJ7WYG2YNRfYIbBUVa sEFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723626018; x=1724230818; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MYn3EAWwM4yksejs7G7ely3yb9R9FB21TAMqGrL5nTo=; b=TJdk0oY14RqnflJQ2RIrVJtWwZC7QTIoRvl9EQpAoQ2j1dHrJ+PIsf1K+5iVOwHd11 RyTIwMrcZq2lTxntK9tQMbXbMYfsHyydGVI45JZwJbCbN5qyDd6gq3G+u91P6cBV3FSG QVKLS5+VDyEmtIQaJDfOEOXvT0HmrEDOpE8pCyOh30SZhumpRF/YlemWhIPaZV58IKk1 rWIOvFjuVOfjsXh3R0gc9RYDXzoIZtWusfGPHdg7l0LF+yNAQzUdP0p4kvd0BJr+vyu2 sjeNfCzpWbM76T8X5VrhC+7cN7kXu97iMOUHaqGfS1e0Qsk13bjC/nkksHqWVnTDtt0U o+Tw== X-Forwarded-Encrypted: i=1; AJvYcCXsFQi2tTVoXTgWHT3U9aao8S0jV6qzBxLpzldcTVOgyAaMniEor69VcGXLQw/uBz8ezEOhkwIhQZi2n7UvfNYdgxk= X-Gm-Message-State: AOJu0Yx8jeJqzGfX5ypJNga0DrUDmIXmY/83Dnjznbhy7iPrumFdLM4g 1zj7nizqu7TRCBcI/lPU/tOJ3iO7TEBB+Y1zfuVEK+lbR1PabVpHy/784Afa2iY= X-Google-Smtp-Source: AGHT+IEKFIA3xVyiHl0S4CHquhD9H7i4oMxDI2QtnLHMSqppM2exFdmcTZJI49EE5Eun1Fvk2Pc9IA== X-Received: by 2002:a05:600c:4751:b0:426:6e8b:3dc5 with SMTP id 5b1f17b1804b1-429dd2674b8mr15872225e9.32.1723626017484; Wed, 14 Aug 2024 02:00:17 -0700 (PDT) Received: from blackdock.suse.cz ([193.86.92.181]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded5c166sm13425345e9.46.2024.08.14.02.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 02:00:16 -0700 (PDT) Date: Wed, 14 Aug 2024 11:00:15 +0200 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: Kinsey Ho Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Yosry Ahmed , Roman Gushchin , Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Tejun Heo , Zefan Li Subject: Re: [PATCH mm-unstable v2 1/5] cgroup: clarify css sibling linkage is protected by cgroup_mutex or RCU Message-ID: References: <20240813204716.842811-1-kinseyho@google.com> <20240813204716.842811-2-kinseyho@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4dnk2aszlbpflxkv" Content-Disposition: inline In-Reply-To: <20240813204716.842811-2-kinseyho@google.com> X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 5979740029 X-Stat-Signature: kx4q1egoor7s5zz4mmhn6k8jkagxrzeu X-HE-Tag: 1723626019-756834 X-HE-Meta: U2FsdGVkX1/fmrBUyMZA+SzQY5MoppWCsa/9wbBsJYZMjP/2/IMBbB9L6rVOsABEr+dwvTblmVmH6tncmr8VFnBQ1KkmT9GzUpL13p5fazfTYOOzc6073fOCXMhymnhxBqivAyAN3AdVf1DPQ7lSoWgiACSSrGmso43jsKycZx2YLlYbRmwo3qglyVYNRK1u9oQWNgvQziIVRVyh5pLGlE0tzX2IkmvNWSoVRzgMo01HZ1XLjaeHVt+abddBD7VA29o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gafEaXN9XGp7975Tlat9iN9+9G8a0Royk1rjyxLXgw9hkb1V8ikeuO9D5Ztcq13hGrjitHLyckTYK0Xq9A4wwmOUhgDOhtyGXDKfUFO5En1ytX/cUdGjQgq6EpnHiYsui6cpywd1VwLXOcM6sR927IPfGUuckyRUHi/u2iCpe/fo84bIsI X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: --4dnk2aszlbpflxkv Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 13, 2024 at 08:47:11PM GMT, Kinsey Ho wro= te: > --- a/include/linux/cgroup-defs.h > +++ b/include/linux/cgroup-defs.h > @@ -172,7 +172,11 @@ struct cgroup_subsys_state { > /* reference count - access via css_[try]get() and css_put() */ > struct percpu_ref refcnt; > =20 > - /* siblings list anchored at the parent's ->children */ > + /* > + * siblings list anchored at the parent's ->children > + * > + * linkage is protected by cgroup_mutex or RCU > + */ > struct list_head sibling; > struct list_head children; Thanks, this is good. > =20 > diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c > index 0a97cb2ef124..ece2316e2bca 100644 > --- a/kernel/cgroup/cgroup.c > +++ b/kernel/cgroup/cgroup.c > @@ -4602,8 +4602,9 @@ struct cgroup_subsys_state *css_next_child(struct c= group_subsys_state *pos, > * > * While this function requires cgroup_mutex or RCU read locking, it > * doesn't require the whole traversal to be contained in a single criti= cal > - * section. This function will return the correct next descendant as lo= ng > - * as both @pos and @root are accessible and @pos is a descendant of @ro= ot. > + * section. Additionally, it isn't necessary to hold onto a reference to= @pos. > + * This function will return the correct next descendant as long as both= @pos > + * and @root are accessible and @pos is a descendant of @root. > * > * If a subsystem synchronizes ->css_online() and the start of iteration= , a > * css which finished ->css_online() is guaranteed to be visible in the > @@ -4651,8 +4652,9 @@ EXPORT_SYMBOL_GPL(css_next_descendant_pre); > * > * While this function requires cgroup_mutex or RCU read locking, it > * doesn't require the whole traversal to be contained in a single criti= cal > - * section. This function will return the correct rightmost descendant = as > - * long as @pos is accessible. > + * section. Additionally, it isn't necessary to hold onto a reference to= @pos. > + * This function will return the correct rightmost descendant as long as= @pos > + * is accessible. > */ > struct cgroup_subsys_state * > css_rightmost_descendant(struct cgroup_subsys_state *pos) > @@ -4696,9 +4698,9 @@ css_leftmost_descendant(struct cgroup_subsys_state = *pos) > * > * While this function requires cgroup_mutex or RCU read locking, it > * doesn't require the whole traversal to be contained in a single criti= cal > - * section. This function will return the correct next descendant as lo= ng > - * as both @pos and @cgroup are accessible and @pos is a descendant of > - * @cgroup. > + * section. Additionally, it isn't necessary to hold onto a reference to= @pos. > + * This function will return the correct next descendant as long as both= @pos > + * and @cgroup are accessible and @pos is a descendant of @cgroup. > * > * If a subsystem synchronizes ->css_online() and the start of iteration= , a > * css which finished ->css_online() is guaranteed to be visible in the I'd say these comments are unnecessary given the functions have cgroup_assert_mutex_or_rcu_locked() but if it helps overall understanding in broader context, why not. Reviewed-by: Michal Koutn=FD --4dnk2aszlbpflxkv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTd6mfF2PbEZnpdoAkt3Wney77BSQUCZrxyHAAKCRAt3Wney77B Sf7iAP495CZoLwNsmRlK6GZnIO5bw5+Tz9MpJH0otiZdp9dsQAD9HYZ3QHSy7TNL O0igPt3UhE8+G+NKHJC0Usreo2lbSAs= =9Uke -----END PGP SIGNATURE----- --4dnk2aszlbpflxkv--