Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1522003pxp; Thu, 10 Mar 2022 07:06:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdPQZZrpkCg3ThjEaYb4eXLKizYfPFWDJto6YNcX7I77ELiXXuOW/QX1lEXweS9byBHBM5 X-Received: by 2002:aa7:d403:0:b0:40f:739c:cbae with SMTP id z3-20020aa7d403000000b0040f739ccbaemr4799523edq.267.1646924783677; Thu, 10 Mar 2022 07:06:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646924783; cv=none; d=google.com; s=arc-20160816; b=Ui0Dy0lo1AyPv+C5RdhnqepfhKVARUqYE9clvOrHmeEkvYjcuLc8R94lCGvxqeTg0a ujh8O8aR2xq4G+q81BmpkdqxENrsPki9bsVWAcWjAG8Pne3FO7o4B0mzWlWjmHRIdSjo B322NNvfTLv/G8rxn52j2xD4NMqBwQVlwyKJkH3tcyW/GitVFAX927FgtJChGhbBbi+S DPBqEUZ5N/TYxx0Z1Rr4AhTSIu9m5Ads+3qICdGOePthSpF35Jxoilp1k3Abawyh3C6E ApPAsDH8/UYV5LuMn1Ce7mzbgNYE+RB3grnKPLS4zSzLGOPtPxA1TEiTKHpCT1azj9+Z +wNw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=h8zOLWZQKZ/93D7Ms9FdB2LxEwOVP0z1L7SLtmenT3U=; b=Sv0Wxif36ACnie8Q3Z84GamjbzHAeWRKO9Z4WdfEkreG0CZNBzkF3wuiRMEKKs+Lr9 naBswBoldPpyU8B71eDEFbLv9pbtB5Xx16iXAHtjWvZskTG/fXigHtVHVPOl2P4NjjXv XXCklGX19Vnl9y80zaxpPy13j1eOCPfI2bHItCNgt4Xb1WujU/Svq0tC59V1Lp0SNUiH L090UAdIxkoFTzWZBV84Zc/D1Y5b7pySlxsp+hll3Dn/Y2CqfGq1DVp80WGtpgNnrI/h 0kF54816/7vDLCv4MSkRM6C0ZS1c2FGCnmpoKraTDLHh0jZNaio2UqChAM1qp8Rskpde bWWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rH1gIViI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ss23-20020a170907c01700b006ce04d5158asi2512921ejc.194.2022.03.10.07.05.53; Thu, 10 Mar 2022 07:06:23 -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=@kernel.org header.s=k20201202 header.b=rH1gIViI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242021AbiCJMbK (ORCPT + 99 others); Thu, 10 Mar 2022 07:31:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235393AbiCJMbJ (ORCPT ); Thu, 10 Mar 2022 07:31:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AC0F85657; Thu, 10 Mar 2022 04:30:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1431DB825E3; Thu, 10 Mar 2022 12:30:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67109C340E8; Thu, 10 Mar 2022 12:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646915404; bh=BMfXhQNWNRn/yzUdJMcXXLf95J2UZ0eeQUTcFVksuU4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rH1gIViIL+0z6FLcRyuMSAPplogfcfHI8e9WG3jGPGYP8vp5BHWM46PMxPBbCXL1u Nmj4h1U7waVPSPohwN+6fybEM9u4Zk46+H+hVX6lvlVv7BtX4xPEA41htyBcL8+j+i JFZ2iZVegBrcv0rV6MI74QT1leuTdNW9x1B99LNt8P55agpqROOjHpkw+XFKw9tcXe jKEpWV9DHq9Z28pfvVRv5OLnq3Ve0wh5RR/JA5qQLGiB+ygSmUB9vKyzr4vTEh0pUG XTI4lPqHRX7R29TNH5SeuzesbaO1lVcKjX96/kB+j6bzgMHbdmpdD3D1zRhpWNoni6 tg4W5b9t9yMqA== Date: Thu, 10 Mar 2022 14:29:48 +0200 From: Mike Rapoport To: Yu Zhao Cc: Andrew Morton , Linus Torvalds , Andi Kleen , Aneesh Kumar , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, x86@kernel.org, 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 , Vaibhav Jain Subject: Re: [PATCH v9 13/14] mm: multi-gen LRU: admin guide Message-ID: References: <20220309021230.721028-1-yuzhao@google.com> <20220309021230.721028-14-yuzhao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220309021230.721028-14-yuzhao@google.com> X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Hi, On Tue, Mar 08, 2022 at 07:12:30PM -0700, Yu Zhao wrote: > Add an admin guide. > > Signed-off-by: Yu Zhao > Acked-by: Brian Geffon > Acked-by: Jan Alexander Steffens (heftig) > Acked-by: Oleksandr Natalenko > Acked-by: Steven Barrett > Acked-by: Suleiman Souhlal > Tested-by: Daniel Byrne > Tested-by: Donald Carr > Tested-by: Holger Hoffst?tte > Tested-by: Konstantin Kharlamov > Tested-by: Shuang Zhai > Tested-by: Sofia Trinh > Tested-by: Vaibhav Jain > --- > Documentation/admin-guide/mm/index.rst | 1 + > Documentation/admin-guide/mm/multigen_lru.rst | 146 ++++++++++++++++++ > mm/Kconfig | 3 +- > 3 files changed, 149 insertions(+), 1 deletion(-) > create mode 100644 Documentation/admin-guide/mm/multigen_lru.rst > > diff --git a/Documentation/admin-guide/mm/index.rst b/Documentation/admin-guide/mm/index.rst > index c21b5823f126..2cf5bae62036 100644 > --- a/Documentation/admin-guide/mm/index.rst > +++ b/Documentation/admin-guide/mm/index.rst > @@ -32,6 +32,7 @@ the Linux memory management. > idle_page_tracking > ksm > memory-hotplug > + multigen_lru > nommu-mmap > numa_memory_policy > numaperf > diff --git a/Documentation/admin-guide/mm/multigen_lru.rst b/Documentation/admin-guide/mm/multigen_lru.rst > new file mode 100644 > index 000000000000..4ea6a801dc56 > --- /dev/null > +++ b/Documentation/admin-guide/mm/multigen_lru.rst > @@ -0,0 +1,146 @@ > +.. SPDX-License-Identifier: GPL-2.0 > + > +============= > +Multi-Gen LRU > +============= I'm still missing an opening paragraph the explains what is Multi-gen LRU and why users would want it. Something like Multi-gen LRU is an efficient mechanism for page reclamation. More details are of course welcome :) > +Quick start > +=========== > +Build the kernel with the following configurations. > + > +* ``CONFIG_LRU_GEN=y`` > +* ``CONFIG_LRU_GEN_ENABLED=y`` > + > +All set! > + > +Runtime options > +=============== > +``/sys/kernel/mm/lru_gen/`` contains stable ABIs described in the > +following subsections. > + > +Kill switch > +----------- > +``enable`` accepts different values to enable or disabled the ^ disable > +following components. The default value of this file depends on > +``CONFIG_LRU_GEN_ENABLED``. All the components should be enabled > +unless some of them have unforeseen side effects. Writing to > +``enable`` has no effect when a component is not supported by the > +hardware, and valid values will be accepted even when the main switch > +is off. > + > +====== =============================================================== > +Values Components > +====== =============================================================== > +0x0001 The main switch for the multi-gen LRU. > +0x0002 Clearing the accessed bit in leaf page table entries in large > + batches, when MMU sets it (e.g., on x86). This behavior can > + theoretically worsen lock contention (mmap_lock). If it is > + disabled, the multi-gen LRU will suffer a minor performance > + degradation. > +0x0004 Clearing the accessed bit in non-leaf page table entries as > + well, when MMU sets it (e.g., on x86). This behavior was not > + verified on x86 varieties other than Intel and AMD. If it is > + disabled, the multi-gen LRU will suffer a negligible > + performance degradation. > +[yYnN] Apply to all the components above. > +====== =============================================================== > + > +E.g., > +:: > + > + echo y >/sys/kernel/mm/lru_gen/enabled > + cat /sys/kernel/mm/lru_gen/enabled > + 0x0007 > + echo 5 >/sys/kernel/mm/lru_gen/enabled > + cat /sys/kernel/mm/lru_gen/enabled > + 0x0005 > + > +Thrashing prevention > +-------------------- > +Personal computers are more sensitive to thrashing because it can > +cause janks (lags when rendering UI) and negatively impact user > +experience. The multi-gen LRU offers thrashing prevention to the > +majority of laptop and desktop users who do not have ``oomd``. > + > +Users can write ``N`` to ``min_ttl_ms`` to prevent the working set of > +``N`` milliseconds from getting evicted. The OOM killer is triggered > +if this working set cannot be kept in memory. In other words, this > +option works as an adjustable pressure relief valve, and when open, it > +terminates applications that are hopefully not being used. > + > +Based on the average human detectable lag (~100ms), ``N=1000`` usually > +eliminates intolerable janks due to thrashing. Larger values like > +``N=3000`` make janks less noticeable at the risk of premature OOM > +kills. What is the default value of min_ttl_ms? > + > +Experimental features > +===================== -- Sincerely yours, Mike.