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_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 B3D0FC07E9B for ; Wed, 7 Jul 2021 20:41:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1F6DA61CCB for ; Wed, 7 Jul 2021 20:41:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F6DA61CCB 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 075B46B005D; Wed, 7 Jul 2021 16:41:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 04C1A6B006C; Wed, 7 Jul 2021 16:41:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2F336B0070; Wed, 7 Jul 2021 16:41:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C089F6B005D for ; Wed, 7 Jul 2021 16:41:10 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 32A388143448 for ; Wed, 7 Jul 2021 20:41:10 +0000 (UTC) X-FDA: 78336961500.02.60071B0 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf14.hostedemail.com (Postfix) with ESMTP id 9FB896002093 for ; Wed, 7 Jul 2021 20:41:09 +0000 (UTC) Received: by mail-pl1-f182.google.com with SMTP id m15so1742420plx.7 for ; Wed, 07 Jul 2021 13:41:09 -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=R4P0KNfgWIHNUMQeKArxNiZXWY4TL6SD38burZdGtmU=; b=jxcBI4tRdXz8lueNWijVft6b8D9Bs/Ztrx6y/abhbFp/1koc4S09E5BLEuvjihUSlV 44gQzlL6BNXxn1NhWf9bM3ZwXXByfzIj6qfBavenyQQO3BW04/c/oW9WpaXTwr72wHDe XExZc+OZQbvQ3SXVOqOqpyz+Og2mAaCFUCZxpVI6siymiro/itdnoB54RINqCWRif1rO xVd0QlGQZIh7EwKTD2c0uw86WIX7r06KfxDLxql/OR1hpgtjsYfAtRpBiaNtAVSBC2EI 8wJ+ynVom4czdgqpPyT7yKvBv97YH5anfQkzZ6mhgQ7k5d0MZL66cw3TcC9AvwtB7JFZ f0Mg== 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=R4P0KNfgWIHNUMQeKArxNiZXWY4TL6SD38burZdGtmU=; b=ZH3r/S4blbb/qPmNyeO11gz+Sf8lB7q4tanQJz2hdP12U8aEeoidHRhuZYqKOMEkQg VDB0wg8kuQ/xpXLjch67AYwfnAqroU1Gge+xGyxwTU7gjcZLLx/F2fmXMLfbQige/mh3 tD3yGHZemOIKXMJHzTGEjfYB8YxAKOb+Q668sqDcrhw09V1sklgOW7NSMXgZE2CShFpA vFwOKVwfU7fxtV47A+C/RihLLvxH/96k2asMUXgh4Xt39PIMb25QSHAnxdSE3dFd/7qY KzB4tXpNGX/WoAI8zbyFJWSdtALF69IyFTEw8LhYFK4O0iBGO0HvHQHtxMaLUm905Vxu O0Gw== X-Gm-Message-State: AOAM530Qcsw4A6ka6AjI/zEza7N457LGXemmq4oP4lEnBixLa5xfe4Rm KrRL9JWUEz34S4y0eGY79Rnanw== X-Google-Smtp-Source: ABdhPJxNV60mHk9QdfMdqDZ9XuKOsJOhvCk+yXfJMgYynl0hy+ru6RNPGsji0WHlpZpAAKl4l39XBw== X-Received: by 2002:a17:90a:1749:: with SMTP id 9mr4905468pjm.97.1625690468414; Wed, 07 Jul 2021 13:41:08 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:e0c7]) by smtp.gmail.com with ESMTPSA id d25sm105765pgn.42.2021.07.07.13.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 13:41:07 -0700 (PDT) Date: Wed, 7 Jul 2021 16:41:05 -0400 From: Johannes Weiner To: Matthew Wilcox 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-Rspam-User: nil Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=jxcBI4tR; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf14.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.214.182 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9FB896002093 X-Stat-Signature: shx95bwppj13ca4s76m3c1xb3xksx1uf X-HE-Tag: 1625690469-591607 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 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. 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. I don't mind fixing poorly chosen or misleading naming schemes, but I think we need better explanations to overcome the reasoning behind the existing names, not just the assumption that there weren't any.