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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 329EAC433EF for ; Thu, 3 Mar 2022 21:43:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B281D8D0002; Thu, 3 Mar 2022 16:43:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AAF878D0001; Thu, 3 Mar 2022 16:43:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 929C08D0002; Thu, 3 Mar 2022 16:43:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 80AB58D0001 for ; Thu, 3 Mar 2022 16:43:46 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4DF0525975 for ; Thu, 3 Mar 2022 21:43:46 +0000 (UTC) X-FDA: 79204402452.02.7805F01 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) by imf20.hostedemail.com (Postfix) with ESMTP id 8EF0B1C0003 for ; Thu, 3 Mar 2022 21:43:45 +0000 (UTC) Received: by mail-qt1-f181.google.com with SMTP id s6so2500505qtc.4 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=WbGNRXKVzayCBPpvzG+MZfEmgjN2JV4z1tN5VrYUMK4adwmiQOfjEcx2Mq6NyCbAeQ KDo99W5rlV2+FtIi1bINXYOoOkfyHRnT6s8N8YoQymxD/0UUo26uLmELqxIHo/MkN0K8 rRkGCUEuIM/q9B072zqW8vxlNU7LUkld1wjuZQwV8kLZRMtgTRax0EjBvCETwSY/0oVl 8aodfgUVZMTPfFZ2159HSAW/ieZJuNkcDzlncTnTwVn2vruN7KJu/Z9qs09P7Glfk0Be Z2ElsnR1dib6OcC8I6y8ibGposgas9YqSJXFsxaoplgqnfzPwrqLvTATGeXYIif3zp3K X8XA== X-Gm-Message-State: AOAM530CFUmdsrjuKeQlkreI0x5RaRulvyH0ME56JNEzDrumr7hEspDb OmD3/rzbB6oS0lCTkB39OmHiAw== X-Google-Smtp-Source: ABdhPJzFu79fPe/pA+ZUmBn0NTH8kz6UBe2UfFjuH7s7jtI5XJqDyMox+AgQF9nHb+vLn+ADauoR2g== 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-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 8EF0B1C0003 X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=bq6u4nU3; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.181 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Stat-Signature: csszx7o4ywkzctqi7c339wogqommczya X-HE-Tag: 1646343825-212855 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 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.