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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 CCD6BC54FC9 for ; Tue, 21 Apr 2020 14:34:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 64A9D20656 for ; Tue, 21 Apr 2020 14:34:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="yYEhL7H/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64A9D20656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E42CB8E001D; Tue, 21 Apr 2020 10:34:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF18B8E0003; Tue, 21 Apr 2020 10:34:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBE118E001D; Tue, 21 Apr 2020 10:34:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id AEECA8E0003 for ; Tue, 21 Apr 2020 10:34:39 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 72737181AEF1D for ; Tue, 21 Apr 2020 14:34:39 +0000 (UTC) X-FDA: 76732108278.23.land70_62c8fd48c2661 X-HE-Tag: land70_62c8fd48c2661 X-Filterd-Recvd-Size: 4465 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Tue, 21 Apr 2020 14:34:38 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id v7so14711150qkc.0 for ; Tue, 21 Apr 2020 07:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=W/B7BqjKBM4LZhb4muvBIRGp0mx98vy+3KswtAICBb4=; b=yYEhL7H/J2T6a6KKsWtsnbqwV2cWxzG4KCkGuvV+HGGqMt695cfXAFayLf634O0D8N z82YE/+6dzOh9T+J54Go3udpMsHkfEiyEfpQQEFz+ni8Z3fO6HNe/+OEWnKNZGvCrQFv 7MyV/oxIsGW5GZYEwaAvXlBxuvKYFNlzgnnPsGfdVhqH4efEsitrvCJ56KEkW1B6EH7w odftt7b2/bH6woOvOhVei6k0Joeaku1g3SZ20UgwSTx5fB7+fyYrg6uvz74nLee6+ml6 5mnXx36doD8smCo0G5RTwTbK3elxGEOatUHv/n1//Z4svtrHZLE23Us6aYYi73MYJ3Ey vEZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=W/B7BqjKBM4LZhb4muvBIRGp0mx98vy+3KswtAICBb4=; b=WFg5AgY2quRC22BtvixAugm+AOQAzhn4saQtUx+G+zTrs/aG7pwWUpPNV9JWuC7pVv lAJcZGeXLL2oK6ib0XrW7E+alSgQ+rMerg4oQn2AUwNYw3zxnNL1z7dm01D1ysKZWrXN SjFrssAAF2HaA1KzXt5Q2Rp0HjxitINjt0nWN4hDWUL/59xyyMk7KH8GjpiGDkdHLMR4 tqnRVCj4DO+US1b07nLFBU1RRA8LlDarHicRrEuDbj5Og3Pyoiq2xBGKa4002sL7yACp S6VpDBD/t3ZqFtQj8CHCOS6AZG51FAohN6m5bpHAYRp3Y8mWueQxO7/T6XrTh+q1yLhy NlCg== X-Gm-Message-State: AGi0PuZidINq/aGfx729006nhF2zHMHKinq08CVHJ+2sLuSNPulPok/z mT8429h8HEQHPDYs30JNxIpuPA== X-Google-Smtp-Source: APiQypJDgokxNuDXaXcXJrXUlJsXPY/rZTc78iXB1zdm3cuK8LKoUspcWCkYeXie16EUDE3J1THnEA== X-Received: by 2002:a37:48a:: with SMTP id 132mr22236543qke.390.1587479678044; Tue, 21 Apr 2020 07:34:38 -0700 (PDT) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id u35sm1753086qtd.88.2020.04.21.07.34.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 07:34:37 -0700 (PDT) Date: Tue, 21 Apr 2020 10:34:35 -0400 From: Johannes Weiner To: Hillf Danton Cc: Joonsoo Kim , Alex Shi , Shakeel Butt , Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 18/18] mm: memcontrol: update page->mem_cgroup stability rules Message-ID: <20200421143435.GB341682@cmpxchg.org> References: <20200420221126.341272-1-hannes@cmpxchg.org> <20200421091014.2180-1-hdanton@sina.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200421091014.2180-1-hdanton@sina.com> 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 Tue, Apr 21, 2020 at 05:10:14PM +0800, Hillf Danton wrote: > > On Mon, 20 Apr 2020 18:11:26 -0400 Johannes Weiner wrote: > > > > The previous patches have simplified the access rules around > > page->mem_cgroup somewhat: > > > > 1. We never change page->mem_cgroup while the page is isolated by > > somebody else. This was by far the biggest exception to our rules > > and it didn't stop at lock_page() or lock_page_memcg(). > > > > 2. We charge pages before they get put into page tables now, so the > > somewhat fishy rule about "can be in page table as long as it's > > still locked" is now gone and boiled down to having an exclusive > > reference to the page. > > > > Document the new rules. Any of the following will stabilize the > > page->mem_cgroup association: > > > > - the page lock > > - LRU isolation > > - lock_page_memcg() > > - exclusive access to the page > > Then rule-1 makes rule-3 no longer needed in mem_cgroup_move_account()? Well, mem_cgroup_move_account() is the write side. It's the function that changes page->mem_cgroup. So it needs to take all these locks in order for the readside / fastpath to be okay with any one of them.