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=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 473BFC07E99 for ; Fri, 9 Jul 2021 19:37:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 564AE61369 for ; Fri, 9 Jul 2021 19:37:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 564AE61369 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E57826B0073; Fri, 9 Jul 2021 15:37:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E07A56B0078; Fri, 9 Jul 2021 15:37:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCF3E6B007B; Fri, 9 Jul 2021 15:37:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0070.hostedemail.com [216.40.44.70]) by kanga.kvack.org (Postfix) with ESMTP id AA6846B0073 for ; Fri, 9 Jul 2021 15:37:42 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DA1D818015868 for ; Fri, 9 Jul 2021 19:37:41 +0000 (UTC) X-FDA: 78344059122.18.6EB2C3B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP id 02D5D50000A1 for ; Fri, 9 Jul 2021 19:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NSCopvszCC1CSQBihfy/wQ6YKMewMTvEX+BC7Lge88Y=; b=p1R0mSzekt6b2fbhE2L/zRNEPk KsD46kJcmtCk5eFykGuqZQPpQuh7+2fcMbExrZWUNEB11is1B8Mn3qqMttBjr72E7F3UNiSilUmrS 5CaFFXiu/c2MjTq1ye+tzTK10Y5cKPz2SEJqsAwOu3rp/xInhpj11Ej3ST1eQji1w7eHZN4mGMFDy Rx5tW6v9ZTOmzRpIeq0sNGE5l7JW8gOfjN1/R7WdZwGcUc1lg9QTq9R60xRY4LZjvW9Oc2AW+cinx SuhT7vR97NNGLaK0QSLQdGX7tWjtQUvslD7MN5ybfBxudP8YKgOPRHDYSL4YyvnMS2qEyHB+zqH/o e9SDkdiw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m1wJT-00Eoov-Ou; Fri, 09 Jul 2021 19:37:31 +0000 Date: Fri, 9 Jul 2021 20:37:27 +0100 From: Matthew Wilcox To: Johannes Weiner Cc: linux-mm@kvack.org, cgroups@vger.kernel.org, Michal Hocko , Vladimir Davydov Subject: Re: [PATCH v3 13/18] mm/memcg: Add folio_memcg_lock() and folio_memcg_unlock() Message-ID: References: <20210630040034.1155892-1-willy@infradead.org> <20210630040034.1155892-14-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 02D5D50000A1 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=p1R0mSze; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Stat-Signature: qk6hggiaxws6ujacf9s9ciaxu3g66qdh X-HE-Tag: 1625859460-885131 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 Wed, Jul 07, 2021 at 04:41:05PM -0400, Johannes Weiner wrote: > On Wed, Jul 07, 2021 at 08:28:39PM +0100, Matthew Wilcox wrote: > > On Wed, Jul 07, 2021 at 01:08:51PM -0400, Johannes Weiner wrote: > > > On Wed, Jun 30, 2021 at 05:00:29AM +0100, Matthew Wilcox (Oracle) wrote: > > > > -static void __unlock_page_memcg(struct mem_cgroup *memcg) > > > > +static void __memcg_unlock(struct mem_cgroup *memcg) > > > > > > This is too generic a name. There are several locks in the memcg, and > > > this one only locks the page->memcg bindings in the group. > > > > Fair. __memcg_move_unlock looks like the right name to me? > > Could you please elaborate what the problem with the current name is? > > mem_cgroup_move_account() does this: > > lock_page_memcg(page); > page->memcg = to; > __unlock_page_memcg(from); > > It locks and unlocks the page->memcg binding which can be done coming > from the page or the memcg. The current names are symmetrical to > reflect that it's the same lock. OK, so in the prerequisite series to this patch, lock_page() becomes folio_lock(). This series turns lock_page_memcg() into folio_memcg_lock(). As a minimum, then, this needs to turn into __folio_memcg_unlock(). > We could switch them both to move_lock, but as per the other email, > lock_page_memcg() was chosen to resemble lock_page(). Because from a > memcg POV they're interchangeable - the former is just a more narrowly > scoped version for contexts that don't hold the page lock. It used to > be called something else and we had several contexts taking redundant > locks on accident because this hierarchy wasn't clear. Unfortunately, it's still not clear. I've answered questions from people who think that they have the page locked because they called lock_page_memcg() ;-(