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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52035C433F5 for ; Thu, 3 Mar 2022 21:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236617AbiCCVoc (ORCPT ); Thu, 3 Mar 2022 16:44:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231588AbiCCVoc (ORCPT ); Thu, 3 Mar 2022 16:44:32 -0500 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E26FDF4A8 for ; Thu, 3 Mar 2022 13:43:45 -0800 (PST) Received: by mail-qt1-x835.google.com with SMTP id f18so5856482qtb.3 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=czMb+1jlgig2/kaaxm+F8ttbLRbVxUf2cOUx5cpmbBKfmg/ZQMgeRSxIx1zWjOb0Ke wvmO0wIy/HxTXKCy0472PKfzD3KQwhWAHxBnH4rjd6D1qPeUnAhoxnYRsicflHyVyEdj n6pFcutv0mjkc14xgPk/ELiFDoJxl9qDTY8Uj7pM5RlFrXGZ0/Op5lM7V71ZmZ/Tu5Bx huQDJqo1c36f+ZnLyY2eIMMfMZw5UYtqWeJGjqa1ZiZ/t8R/v7nxml4kgyr8d+EKAuYR QfX48d1/ogD3V6nsycmYf2tdrJMiF/vK1uGQ7lGHWtIzQItfD3/6lCf9JOACpo4WoSk4 XQkw== X-Gm-Message-State: AOAM530DtIffyi3GMZWVgT5+ro+CKLK0bsJfqf1BimJ/1iiCPPc61/gM 7zHI1EkrsImw7tE0PYbQZ8GywA== 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: Precedence: bulk List-ID: X-Mailing-List: linux-doc@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.