Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp638710pxb; Thu, 15 Apr 2021 03:06:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxG8njlbNx4AtEiwDdtmCrDEp9hCxqdxsvaKOA20KWWMRDz4TAYGQdREwSwqQKoJ7psGjS8 X-Received: by 2002:aa7:cd83:: with SMTP id x3mr3098935edv.373.1618481164070; Thu, 15 Apr 2021 03:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618481164; cv=none; d=google.com; s=arc-20160816; b=Y4UtxCPqbWm2kIyzlGWA96ZYH5Iv1+WsgnYbHKvY1LjJVoPUjMpDiDU/eqLmTRe6v1 rhLdkBACivikrObyFAqlUj86yCcqaRryYoibd90eF2/kKGQaTRSU4FLWAGr1phGeY/r2 5BE1bTiC/ZaplcsaPC0j5pZ8UpVn+MFgAdM6TvPEeF41qTCSZEMZE++IOAt60athsmB3 BzEjpOxdmH3f1HuBTK6TrCSFYNcFy4V+jM+3wiPq8vj3FG+rFcAy2ZO7Y8n6yxoqofym P8Ih/t3WTXFnbuynIDpLZdJmw6iGos1FevxwK0Bi4kdMzGANc77JglylhXvUgTxWK65w o3vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Zm6WOLpoBupP5HjBPdb3l9pYDvQOSku0pOkw8t2295U=; b=GXbpsle88F+CIbp7DT2G17KZHqe3TZBqgltb++od4Iw+iOnPINO3dgtUvSQ6JY93LY Cqv/rPmihmI+WOt/UIQdY3nlGtKk+2/Q2Hb2m/Rh4Fo1pcUE2LhSbwxMu1wwrMmtCwFG HzsdpHV3l51xeLKj5jB0djUM9DJJwJbRhh30nw6iPzUAqAmLjq8mqVr4hBUWkoJvvLeG MAN1MwvsADPCJiaHo4kwlCYhb0SV/W8yYqApF5keqcxKrFa6WItCAv3hZ/h79ISrhFPy H5blDnX9/tJyicQYM2aleXc7UsNV1VGui35Oak1ObqMtJOIOOitWQ++X6waYQU0bm1JI 3e8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=j4Iyb3iI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u16si1775522eje.91.2021.04.15.03.05.36; Thu, 15 Apr 2021 03:06:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=j4Iyb3iI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229481AbhDOKCu (ORCPT + 99 others); Thu, 15 Apr 2021 06:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbhDOKCp (ORCPT ); Thu, 15 Apr 2021 06:02:45 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64FDDC061574 for ; Thu, 15 Apr 2021 03:02:21 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d8so11760896plh.11 for ; Thu, 15 Apr 2021 03:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Zm6WOLpoBupP5HjBPdb3l9pYDvQOSku0pOkw8t2295U=; b=j4Iyb3iIzlUmiMrepUSmxPvgLsBjtBUY9oW1JFiiGooOW/MM7tJyI686cDprjLhKhG 0RxNwyJ6DSqcxWRpM+qG96okUZ00v72RSqY9S38fwz3Y6bQczIUSvLx4H72t5hqWNBo9 DyhISgnfnVl2NYzMRRsjwRyR/FavV8c3pGIydbSVC8Qb7TLnOEFmZ9qv8iMKxH9Fqzyr GIhXpaXZ+tXYz/N7a+fhIWjtR+FCjUNL58PUn7yHtrodKkmvhHxYa5+08EjEGRO9XiV+ RW+oTqd1p+ecNFZDRpo+NpNk1Okp1hnmYKO+q85wyrTk3COEVbqsYzi/pfFxCcAuNXUu zWCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Zm6WOLpoBupP5HjBPdb3l9pYDvQOSku0pOkw8t2295U=; b=mNOYsc8yPvXG4PjCbfdWFV9v/MpYBg5lUZEaqIz44N7RU9wCZ5+yN9PL3Ki2KDYJBN vnxx5WT/1lOsWm7pZG3Hm1veIuaRO4e7ZJYxXyJjNlZyabXUqhFg5EQeuGPMtbkkc4fy Gl/4iWT1vlK//pyofO7KVEk1L6CPxPhWE4BqUV8cyOlJ+2uQIkHa9aOp6zlcRyXQo6x8 JH9sBZ5UTXU/AaWruqIhBrNPIEErdyz/e3wD3vp9ZyAuwlfveYM+vCjdgv0XEjrL8XVV r2Of9n98D5t0/nWx56W1OOCJPlo/FbWyZwLN464ydADFQv5Jq4zcXqd1iA352mUz0yX8 brBQ== X-Gm-Message-State: AOAM531nfG55sDhb9fHhQalL8ClPbTNZ4H1en2O727GjIXJVo+b7BqJi CDy05f5YQQixV1Pa7Po/amxHyhzMOSLm9Bfx27fEPA== X-Received: by 2002:a17:902:ea93:b029:eb:65ee:ddd3 with SMTP id x19-20020a170902ea93b02900eb65eeddd3mr3020294plb.24.1618480936088; Thu, 15 Apr 2021 03:02:16 -0700 (PDT) MIME-Version: 1.0 References: <20210413065153.63431-1-songmuchun@bytedance.com> <20210413065153.63431-5-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Thu, 15 Apr 2021 18:01:38 +0800 Message-ID: Subject: Re: [External] Re: [PATCH 4/7] mm: memcontrol: simplify lruvec_holds_page_lru_lock To: Johannes Weiner Cc: Michal Hocko , Roman Gushchin , Andrew Morton , Shakeel Butt , Vladimir Davydov , LKML , Linux Memory Management List , Xiongchun duan , fam.zheng@bytedance.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 15, 2021 at 1:49 AM Johannes Weiner wrote: > > On Wed, Apr 14, 2021 at 06:00:42PM +0800, Muchun Song wrote: > > On Wed, Apr 14, 2021 at 5:44 PM Michal Hocko wrote: > > > > > > On Tue 13-04-21 14:51:50, Muchun Song wrote: > > > > We already have a helper lruvec_memcg() to get the memcg from lruvec, we > > > > do not need to do it ourselves in the lruvec_holds_page_lru_lock(). So use > > > > lruvec_memcg() instead. And if mem_cgroup_disabled() returns false, the > > > > page_memcg(page) (the LRU pages) cannot be NULL. So remove the odd logic > > > > of "memcg = page_memcg(page) ? : root_mem_cgroup". And use lruvec_pgdat > > > > to simplify the code. We can have a single definition for this function > > > > that works for !CONFIG_MEMCG, CONFIG_MEMCG + mem_cgroup_disabled() and > > > > CONFIG_MEMCG. > > > > > > Neat. While you are at it wouldn't it make sesne to rename the function > > > as well. I do not want to bikeshed but this is really a misnomer. it > > > doesn't check anything about locking. page_belongs_lruvec? > > > > Right. lruvec_holds_page_lru_lock is used to check whether > > the page belongs to the lruvec. page_belongs_lruvec > > obviously more clearer. I can rename it to > > page_belongs_lruvec the next version. > > This sounds strange to me, I think 'belongs' needs a 'to' to be > correct, so page_belongs_to_lruvec(). Still kind of a mouthful. > > page_matches_lruvec()? > I prefer this name. If you also agree, I will use this name. Thanks. > page_from_lruvec()?