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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D76DC43215 for ; Thu, 21 Nov 2019 15:28:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0BD21206F4 for ; Thu, 21 Nov 2019 15:28:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0BD21206F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AAD676B032A; Thu, 21 Nov 2019 10:28:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A361F6B0330; Thu, 21 Nov 2019 10:28:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 924FB6B0337; Thu, 21 Nov 2019 10:28:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id 783466B032A for ; Thu, 21 Nov 2019 10:28:53 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 38ABD4435 for ; Thu, 21 Nov 2019 15:28:53 +0000 (UTC) X-FDA: 76180667346.16.ray87_1356dc1c92e37 X-HE-Tag: ray87_1356dc1c92e37 X-Filterd-Recvd-Size: 3487 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 Nov 2019 15:28:52 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7F730B231; Thu, 21 Nov 2019 15:28:51 +0000 (UTC) Date: Thu, 21 Nov 2019 16:28:47 +0100 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Roman Gushchin Cc: "linux-mm@kvack.org" , Andrew Morton , Michal Hocko , Johannes Weiner , "linux-kernel@vger.kernel.org" , Kernel Team , "stable@vger.kernel.org" , Tejun Heo Subject: Re: [PATCH 1/2] mm: memcg: switch to css_tryget() in get_mem_cgroup_from_mm() Message-ID: <20191121152847.GA14375@blackbody.suse.cz> References: <20191106225131.3543616-1-guro@fb.com> <20191113162934.GF19372@blackbody.suse.cz> <20191113170823.GA12464@castle.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dDRMvlgZJXvWKvBx" Content-Disposition: inline In-Reply-To: <20191113170823.GA12464@castle.DHCP.thefacebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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: --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 13, 2019 at 05:08:29PM +0000, Roman Gushchin wrote: > The thing here is that css_tryget_online() cannot pin the online state, > so even if returned true, the cgroup can be offline at the return from > the function. Adding this for the record. The actual offlining happens only from css_killed_ref_fn, which is percpu_ref_kill_and_confirm confirmation callback. That is only called after RCU grace period. So, css_tryget_online will pin the online state _inside_ rcu_read_{,un}lock section. The fact is that many call sites pass the css reference over rcu_read_unlock boundary allowing potential offlining. > So if we rely somewhere on it, it's already broken. Charges into offlined memcg should fine (wrt the original patch). I didn't check other callers though... > Generally speaking, it's better to reduce it's usage to the bare minimum. ...I agree as it's confusing and potentially redundant. Michal --dDRMvlgZJXvWKvBx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEEoQaUCWq8F2Id1tNia1+riC5qSgFAl3WrScACgkQia1+riC5 qShpuA//a/oxK/bmsjDKt4LE1wwkZ3GsY3MsYuExq3lBFEGj8FGXFuDA7qgrTHc5 MTk5HWE2HvGNuF/zUGKElTggicIlcEHb14RjiUpFstAZlVNkgL7CvILRNd+vIKZ8 nA8n509j+H8mtbdtsb9yvHFpvKKwz97X2Rvm8z8fhnzbiQEOOD0vdA/C7mIhVUty YP7mT4GsinaUxlpnD6VP8V656yEM7PPCLSryJaJabdJAnk5rG4GXCfu15GRvGX4u OMlRvSuF0YsRcSD6ay7YHo0+8dXyoLJyhZLyevCyqzRenWY5I6FUAV+1xwlukYY6 WaCPpJn7ZFo/Xb0f4g/2JBjnfw0sSRh9VDlg8Jct0uhckd1dCJIh8/DV2AJEs7X+ Ud+tgZHaULVPwFDI7489ovfdMi0z3xDwUVwCyh0l6x7zxLnrisuwCVPn3BSS6KRE xKDGMbwwqdjviUmWbagxCVJnc140TKvkXvnwApn3yBG5qkYo+2eHHn74gYP7Pg6n GplINVmLDEbJAxD6dtYWR4aKPgBQIJjfjgT8oRp6SNzULyKOm7KB2jyA6T5biHon a7GmuSiOBMse4Ot2YoR5Z4h7AIcNN5HkZjn3phXM2UFRZuacuu/k8fsgSi7Mt3cR qgRY69rUsd57kRC1Bm56FizYUDJL6S7FoeQrk/r2eR7giof1mGM= =CqvJ -----END PGP SIGNATURE----- --dDRMvlgZJXvWKvBx--