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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 E382AC433E0 for ; Fri, 5 Feb 2021 16:06:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 32FBC64F2E for ; Fri, 5 Feb 2021 16:06:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32FBC64F2E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine 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 A51A46B007B; Fri, 5 Feb 2021 11:06:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A01396B007E; Fri, 5 Feb 2021 11:06:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 917706B0080; Fri, 5 Feb 2021 11:06:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id 6EA0D6B007B for ; Fri, 5 Feb 2021 11:06:21 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1B46733C4 for ; Fri, 5 Feb 2021 16:06:21 +0000 (UTC) X-FDA: 77784691362.16.view14_09019d9275e6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id E5C34100E691B for ; Fri, 5 Feb 2021 16:06:20 +0000 (UTC) X-HE-Tag: view14_09019d9275e6 X-Filterd-Recvd-Size: 3633 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 16:06:20 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1612541179; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=X0eNZnPZ2yvNSsohyfO18yi1he4bt+Z9BswCbs9pY3o=; b=YTiJoqhqHI2WHfc/9NOnQxXomFQnQCUwdI5oE5KBAXc1O9bZPxV2+A/3GrVxmdvJKCbIc8 9ChcfYP2M7iEcMltkcdxKxBeP+1W6fktGOqgAaFVj4vBCU4AuFA1sVBIwma+QHOIqOGPkd HlvyEvn0XK+Z44oQX8eZCi+9KntjaFw= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 560A9B0BF; Fri, 5 Feb 2021 16:06:19 +0000 (UTC) Date: Fri, 5 Feb 2021 17:06:18 +0100 From: Michal Hocko To: Shakeel Butt Cc: Roman Gushchin , Muchun Song , Johannes Weiner , Vladimir Davydov , Andrew Morton , Cgroups , Linux Memory Management List , LKML Subject: Re: [External] Re: [PATCH] mm: memcontrol: remove rcu_read_lock from get_mem_cgroup_from_page Message-ID: References: <20210205062719.74431-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: On Fri 05-02-21 07:59:06, Shakeel Butt wrote: > +Cc Roman > > On Fri, Feb 5, 2021 at 2:49 AM Michal Hocko wrote: > > > [snip] > > > > > Also, css_get is enough because page > > > > > has a reference to the memcg. > > > > > > > > tryget used to be there to guard against offlined memcg but we have > > > > concluded this is impossible in this path. tryget stayed there to catch > > > > some unexpected cases IIRC. > > > > > > Yeah, it can catch some unexpected cases. But why is this path > > > special so that we need a tryget? > > > > I do not remember details and the changelog of that change is not > > explicit but I suspect it was just because this one could trigger as > > there are external callers to memcg. Is this protection needed? I am not > > sure, this is for you to justify if you want to remove it. > > > > It used to be css_tryget_online() which was changed to css_tryget() > and from the discussion at [1], it seemed css_get() would be enough > but we took a safer route. > > Anyways, I think we can either take the page_memcg_rcu() route or put > explicit restrictions with page lock or lock_page_memcg() to guarantee > page and memcg binding. I don't have a strong opinion either way but I > think removing restrictions in future for new use-cases will be much > harder, so, page_memcg_rcu() approach seems more appropriate at least > for now. Yeah, I would like to not have very special locking requirements here. Definitely not page_lock as that one is too overloaded already. > > [1] https://lore.kernel.org/linux-mm/CALvZod5pAv=u8L2Tgk0hDY7XAiiF2dvjC1omQ5BSfzFu_2zSXA@mail.gmail.com/ -- Michal Hocko SUSE Labs