Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1469196pxm; Thu, 3 Mar 2022 19:07:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRBxdtMWyc6ZJef4e2ldXrMCTN5+E8XbhbN9y65rJbiWwNsEK5cfB8ZmYnjG7UloUqQQtE X-Received: by 2002:a17:90a:d206:b0:1bb:e73f:9592 with SMTP id o6-20020a17090ad20600b001bbe73f9592mr8447307pju.17.1646363240379; Thu, 03 Mar 2022 19:07:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646363240; cv=none; d=google.com; s=arc-20160816; b=euRvaOdccsqYp+YawwYba8DsgVQen8z3lr8lTthn6lwaEmrAgGiKrDLiEt7JXMmoDz l8aiYY7Cj8ph0wiRgcikgchAJmwJ0wwCFexbf7v0EL+UO3iSjOpl9mJMlIfG+QzNZ45E l32gD9+wu5SbBykCggJfmamW0UvwoDHCmInVYcW+Tt8Xuyb5LnjfACxYLfrJxzMc4W09 1ZSNt8MD33xryOdY6cixGAroxngL4dKPW2or2LfuncQtX43RDBRtDuSddiFi4uYlcNuO oPhnRulo4APiXZkXpCqzYlKj+Q6VTZ10r38jIATFAkVn6YUDTm+zRjmjHJarzC6MPV3J h0OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hTwwN6PiJVHaKqnPKPesjc7eXIn2FCgdMkVnCPREWLc=; b=dJSPbFOr6qWQSJeKTiDT1YQKb4IbkzlePkmYhZQBn5Vbdk/4Xpe7pxzyXyAhciyK19 FHUtTqV/vGVakU4VLLpbip+HKzU5L6h4JGg6E669LkhlSp1eMv2lSM7HArB8O3VCprs+ vr2YlLQAJg8Tq8O2eWOgRXCCGB3nVNawoP8geEij0eytIjLJKN3sVagiBi4dmsxh1of/ gi5tBYPTLH0sVkyaZIoMIp9FHeHPyIdR+tSqVh9YPin+iDG32+2CRvKFZASGjh9XInNW Je5+xNSpoeqASNao62kOvQ1EfMSxxAfHqZF38VUtuavZobkBTFHW4BAFKV+NWmweATv5 B4nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=bq6u4nU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf9-20020a17090b1d8900b001bd2330cfdasi10517693pjb.59.2022.03.03.19.06.55; Thu, 03 Mar 2022 19:07:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=bq6u4nU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236623AbiCCVod (ORCPT + 99 others); Thu, 3 Mar 2022 16:44:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231592AbiCCVoc (ORCPT ); Thu, 3 Mar 2022 16:44:32 -0500 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7785FDF49C for ; Thu, 3 Mar 2022 13:43:45 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id bc10so5847732qtb.5 for ; Thu, 03 Mar 2022 13:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hTwwN6PiJVHaKqnPKPesjc7eXIn2FCgdMkVnCPREWLc=; b=bq6u4nU32h9czB4hqHrURQXbdgy/m7NrxkgoFp2Hqjia8te+uATT004m1EnZOopthW GaTmCBg8Xik6cbS1qGfn/dB5PE1l8OmlWNnFC1WEwdu0EKjaFsGPZd5uUw034wyTvgh/ O6UrmV5s5rdSOlBF+7Wz3yOiFHWzI6DVlAOh19zoSm/F9UD9jwpnv80X/k6AqicljJB2 h0KU8+QZaCRLxl78mf3LXT1f8fVPzTtYE2OiNQrWkE8P3qCE0pkNleQB8vD6O55BKalo wmrD51eJCZvV/qXZBBG09fPPU9Az1vVhsH5OdNVrecuZhj6Ft3kRYHUEoaxiOa4TtXIS TFhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hTwwN6PiJVHaKqnPKPesjc7eXIn2FCgdMkVnCPREWLc=; b=olasp8c2z1ZKMlAWqaRJ7meqtSK0balzbQzNNSCoRCvFCma3k4EZRdYLp0f+5km2ip etHnymzCquGBW1NBF9L+v2CZ/wUP+TNp2Ku3EpBZl7bRinuNpxhjL0Q4CPL358ICOE+4 s5AlKtDPCT5i+SLtmdikccKcW0y1gIyLZ/KZ3rAzeG09QXgG+RujROBU4i0Z+FERIHL0 s4AhAg+BpEFOdWWCP4kKo8zzTd+Z8iEH7RQVdBGsNoMeb+bMpZ9KwV2mx6zJQWX3tWEB YgQMfTSmZUWd9IJxTJ0d7zrcVP6S837a1Jx9RRysaqvO32FgFmaS1yyk71Atfd9b4KiN vRww== X-Gm-Message-State: AOAM532y4GUrbXxQ9crhmNBEd54x9yTCkZZVTDy0bRGzSrctqiG8NC2T 2d4wT3rRotwid2Vh6xjhizSZhQ== X-Received: by 2002:ac8:7c4b:0:b0:2dc:a139:52c7 with SMTP id o11-20020ac87c4b000000b002dca13952c7mr29178649qtv.188.1646343824657; Thu, 03 Mar 2022 13:43:44 -0800 (PST) Received: from localhost (cpe-98-15-154-102.hvc.res.rr.com. [98.15.154.102]) by smtp.gmail.com with ESMTPSA id c6-20020ac87d86000000b002ddd9f33ed1sm2376259qtd.44.2022.03.03.13.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 13:43:43 -0800 (PST) Date: Thu, 3 Mar 2022 16:43:43 -0500 From: Johannes Weiner To: Yu Zhao Cc: Andrew Morton , Mel Gorman , Michal Hocko , Andi Kleen , Aneesh Kumar , Barry Song <21cnbao@gmail.com>, Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Jonathan Corbet , Linus Torvalds , Matthew Wilcox , Michael Larabel , Mike Rapoport , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , Linux ARM , "open list:DOCUMENTATION" , linux-kernel , Linux-MM , Kernel Page Reclaim v2 , the arch/x86 maintainers , Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , Holger =?iso-8859-1?Q?Hoffst=E4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh Subject: Re: [PATCH v7 04/12] mm: multigenerational LRU: groundwork Message-ID: References: <20220208081902.3550911-1-yuzhao@google.com> <20220208081902.3550911-5-yuzhao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 03, 2022 at 12:26:45PM -0700, Yu Zhao wrote: > On Thu, Mar 3, 2022 at 8:29 AM Johannes Weiner wrote: > > On Mon, Feb 21, 2022 at 01:14:24AM -0700, Yu Zhao wrote: > > > On Tue, Feb 15, 2022 at 04:53:56PM -0500, Johannes Weiner wrote: > > > > On Tue, Feb 15, 2022 at 02:43:05AM -0700, Yu Zhao wrote: > > > > > On Thu, Feb 10, 2022 at 03:41:57PM -0500, Johannes Weiner wrote: > > > > > > You can drop the memcg parameter and use lruvec_memcg(). > > > > > > > > > > lruvec_memcg() isn't available yet when pgdat_init_internals() calls > > > > > this function because mem_cgroup_disabled() is initialized afterward. > > > > > > > > Good catch. That'll container_of() into garbage. However, we have to > > > > assume that somebody's going to try that simplification again, so we > > > > should set up the code now to prevent issues. > > > > > > > > cgroup_disable parsing is self-contained, so we can pull it ahead in > > > > the init sequence. How about this? > > > > > > > > diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c > > > > index 9d05c3ca2d5e..b544d768edc8 100644 > > > > --- a/kernel/cgroup/cgroup.c > > > > +++ b/kernel/cgroup/cgroup.c > > > > @@ -6464,9 +6464,9 @@ static int __init cgroup_disable(char *str) > > > > break; > > > > } > > > > } > > > > - return 1; > > > > + return 0; > > > > } > > > > -__setup("cgroup_disable=", cgroup_disable); > > > > +early_param("cgroup_disable", cgroup_disable); > > > > > > I think early_param() is still after pgdat_init_internals(), no? > > > > It's called twice for some reason, but AFAICS the first one is always > > called before pgdat_init_internals(): > > > > start_kernel() > > setup_arch() > > parse_early_param() > > x86_init.paging.pagetable_init(); > > paging_init() > > zone_sizes_init() > > free_area_init() > > free_area_init_node() > > free_area_init_core() > > pgdat_init_internals() > > parse_early_param() > > > > It's the same/similar for arm, sparc and mips. > > Thanks for checking. But I'd rather live with an additional parameter > than risk breaking some archs. As per above, somebody is going to try to make that simplification again in the future. It doesn't make a lot of sense to have a reviewer trip over it, have a discussion about just how subtle this dependency is, and then still leave it in for others. parse_early_param() is documented to be called by arch code early on, there isn't a good reason to mistrust our own codebase like that. And special-casing this situation just complicates maintainability and hackability. Please just fix the ordering and use lruvec_memcg(), thanks.