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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BE7DC433F5 for ; Tue, 26 Apr 2022 23:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Message-Id:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xyYhhGiRRL6CjDpgGv+UrhtuRdU8dYavYqgbS5Ga0QQ=; b=DX6GU/IRzYBjpv c92Akrrk+t3IvZjNfCM1u2GROtkx8yhh25U6p7dkc+Wuc4RH0Z6VtfeFC+yLxm+gSUXjNqCIaGp7T fZos2ns54ZElewgk5JQEHa1nrlFEac2vDZBbL+smR3rsg1M0CRJgjUHx70uniyqcuCPed7eBbKofL ZjW5nLYGneh+4xkNEnYsT51yGP6UnqSIxy/fqU3NKMqcpRgmcPMaBluq/ZgIgSyZ7372HA+VT+RFJ m+ggbqC3+aF2JgPvk0Q/MDUu5JDS4PRc0aKDjDV1nu9b9LeR3unpDhvmQCsg/R0+UgiDHdxRQP1rB gZAJ+5MKha+BCrTt6p0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njUpU-00Gh09-DE; Tue, 26 Apr 2022 23:42:48 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njUpR-00Ggyy-DK for linux-arm-kernel@lists.infradead.org; Tue, 26 Apr 2022 23:42:47 +0000 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 dfw.source.kernel.org (Postfix) with ESMTPS id 8E337619E5; Tue, 26 Apr 2022 23:42:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A33F6C385A0; Tue, 26 Apr 2022 23:42:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1651016564; bh=rkWOOpymajYPINPF/6OKmwxFHU7UQnqmc3SblTgW3GI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Dh/nLmQngZ0x60vGJBUI8w3qIcq8X5L3WO8oRG8EFdQ8xQS4HuEiC+0LmW+KdbPuS DAdi1MD0ubzM0Cd93Pc5pxiRX/9JMruLVwwOGe4+clWiHvKERN/AO93Lt08ZIKpY0E rtXOwE7HdtS4x9VHAAKpSVHkmmMAV0mO16pJ2Lb0= Date: Tue, 26 Apr 2022 16:42:41 -0700 From: Andrew Morton To: Yu Zhao Cc: Stephen Rothwell , Linux-MM , Andi Kleen , Aneesh Kumar , Barry Song <21cnbao@gmail.com>, Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Linus Torvalds , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Mike Rapoport , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , Linux ARM , "open list:DOCUMENTATION" , linux-kernel , 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 , Vaibhav Jain Subject: Re: [PATCH v10 05/14] mm: multi-gen LRU: groundwork Message-Id: <20220426164241.99e6a283c371ed75fa5c12a0@linux-foundation.org> In-Reply-To: References: <20220407031525.2368067-1-yuzhao@google.com> <20220407031525.2368067-6-yuzhao@google.com> <20220411191615.a34959bdcc25ef3f9c16a7ce@linux-foundation.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220426_164245_576721_94764C62 X-CRM114-Status: GOOD ( 31.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 26 Apr 2022 16:39:07 -0600 Yu Zhao wrote: > On Mon, Apr 11, 2022 at 8:16 PM Andrew Morton wrote: > > > > On Wed, 6 Apr 2022 21:15:17 -0600 Yu Zhao wrote: > > > > > Evictable pages are divided into multiple generations for each lruvec. > > > The youngest generation number is stored in lrugen->max_seq for both > > > anon and file types as they are aged on an equal footing. The oldest > > > generation numbers are stored in lrugen->min_seq[] separately for anon > > > and file types as clean file pages can be evicted regardless of swap > > > constraints. These three variables are monotonically increasing. > > > > > > ... > > > > > > +static inline bool lru_gen_del_folio(struct lruvec *lruvec, struct folio *folio, bool reclaiming) > > > > There's a lot of function inlining here. Fortunately the compiler will > > ignore it all, because some of it looks wrong. Please review (and > > remeasure!). If inlining is reqlly justified, use __always_inline, and > > document the reasons for doing so. > > I totally expect modern compilers to make better decisions than I do. > And personally, I'd never use __always_inline; instead, I'd strongly > recommend FDO/LTO. My (badly expressed) point is that there's a lot of inlining of large functions here. For example, lru_gen_add_folio() is huge and has 4(?) call sites. This may well produce slower code due to the icache footprint. Experiment: moving lru_gen_del_folio() into mm/vmscan.c shrinks that file's .text from 80612 bytes to 78956. I tend to think that out-of-line regular old C functions should be the default and that the code should be inlined only when a clear benefit is demonstrable, or has at least been seriously thought about. > > > --- a/mm/Kconfig > > > +++ b/mm/Kconfig > > > @@ -909,6 +909,14 @@ config ANON_VMA_NAME > > > area from being merged with adjacent virtual memory areas due to the > > > difference in their name. > > > > > > +config LRU_GEN > > > + bool "Multi-Gen LRU" > > > + depends on MMU > > > + # the following options can use up the spare bits in page flags > > > + depends on !MAXSMP && (64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP) > > > + help > > > + A high performance LRU implementation to overcommit memory. > > > + > > > source "mm/damon/Kconfig" > > > > This is a problem. I had to jump through hoops just to be able to > > compile-test this. Turns out I had to figure out how to disable > > MAXSMP. > > > > Can we please figure out a way to ensure that more testers are at least > > compile testing this? Allnoconfig, defconfig, allyesconfig, allmodconfig. > > > > Also, I suggest that we actually make MGLRU the default while in linux-next. > > The !MAXSMP is to work around [1], which I haven't had the time to > fix. That BUILD_BUG_ON() shouldn't assert sizeof(struct page) == 64 > since the true size depends on WANT_PAGE_VIRTUAL as well as > LAST_CPUPID_NOT_IN_PAGE_FLAGS. My plan is here [2]. > > [1] https://lore.kernel.org/r/20190905154603.10349-4-aneesh.kumar@linux.ibm.com/ > [2] https://lore.kernel.org/r/Ygl1Gf+ATBuI%2Fm2q@google.com/ OK, thanks. This is fairly urgent for -next and -rc inclusion. If practically nobody is compiling the feature then practically nobody is testing it. Let's come up with a way to improves the expected coverage by a lot. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel