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 67A74C433F5 for ; Sun, 13 Feb 2022 21:16:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB2536B0072; Sun, 13 Feb 2022 16:16:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E61326B0073; Sun, 13 Feb 2022 16:16:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDB456B0078; Sun, 13 Feb 2022 16:16:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id BB2EE6B0072 for ; Sun, 13 Feb 2022 16:16:15 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7BAF89A26C for ; Sun, 13 Feb 2022 21:16:15 +0000 (UTC) X-FDA: 79139014710.12.FF10FE3 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by imf26.hostedemail.com (Postfix) with ESMTP id 0EE67140007 for ; Sun, 13 Feb 2022 21:16:14 +0000 (UTC) Received: by mail-io1-f51.google.com with SMTP id w7so17801224ioj.5 for ; Sun, 13 Feb 2022 13:16:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HoEQyB0wXuP36DzZ0QRkHqCD5SbkH+algRG5wEjwJXo=; b=h5N69fHGI7cZvuuQQQVEWq5Ocbd1LmgnZQMruZWLFS62Tf0f3r6KH42yPIcbnpUzPe TOn2cr/eU2bgt8ZGSdvN9x7aDu4Bhxk+oygox+iO/oUp7WJGV50FSWgs66oeuvA2WYnI 1sVuzNVISszFEapEIRj7yG/HqKMqyFtZ2ZqqpcerSoEhNeldBdH/ktro0S0cvKStf8Hm 2xifBMI7o4a9q0RW+OVDeqxbjym3XwIzszWyGaTHbmojx1Jkjbz4tT0rCY4ML4+hfHJt uT8ZOyTX5nHvhZHk3nUbalAYxRip7KmO44j/1qtzTwg2iu86F1sZusw7FqD5PtqJ5Hon Xabg== 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=HoEQyB0wXuP36DzZ0QRkHqCD5SbkH+algRG5wEjwJXo=; b=KywUihCbHsv/ttEMYidnJDU5K4n406pBIBuB/PI3u/grwwKoqmn3PT0W9S+EnInPxD MEf2FpUdeP9O3PSV+z8g4q2GZbA0LfcrQ065Bf++u+MvhlWzjnmQY8e2naxAu8y4lCDt kDKFbBWGzBdFRvL633MhBls5M3ZHERRYF1yg8SOGBc52eV+MpbxP2tqxKs0AK+/cT2dE XqB2OBWtN/khBXDzR5XvyloAbAAG46fs5GvBpTUmQhJe5/FLyEAvRzoTn025hjdla3/4 YZuDEhD9HVrVrkLA57bqT1tXBIycOFOkNDQ59Y3f8sprAYBcp8nv0JGVa8TLFwFQd/Na G3dg== X-Gm-Message-State: AOAM533rRIpyOLyMJ02T/NTt2o8cOAJb9em0ZklVxJO16psFjKskxeXE WbEBWzUEXAmJhJuTyIK2e7frsA== X-Google-Smtp-Source: ABdhPJx2zA0Qgp3jj6EvOzNNp5e5TWs1qwwakXa6kVQ5HAZUV4wNcOsmNoaH07/PQ38CF5kNKnRKiw== X-Received: by 2002:a05:6602:1656:: with SMTP id y22mr5599323iow.34.1644786974067; Sun, 13 Feb 2022 13:16:14 -0800 (PST) Received: from google.com ([2620:15c:183:200:4782:b5ed:f641:ee91]) by smtp.gmail.com with ESMTPSA id q2sm12515494ilt.33.2022.02.13.13.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 13:16:13 -0800 (PST) Date: Sun, 13 Feb 2022 14:16:09 -0700 From: Yu Zhao To: Matthew Wilcox Cc: Andrew Morton , Johannes Weiner , 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 , Michael Larabel , Mike Rapoport , 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 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-Stat-Signature: 9hsxdauoxd1een4p1o3q5otn5ycw78u1 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 0EE67140007 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=h5N69fHG; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of yuzhao@google.com designates 209.85.166.51 as permitted sender) smtp.mailfrom=yuzhao@google.com X-Rspam-User: X-HE-Tag: 1644786974-652077 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, Feb 10, 2022 at 09:37:25PM +0000, Matthew Wilcox wrote: > On Tue, Feb 08, 2022 at 01:18:54AM -0700, Yu Zhao wrote: [...] > > +++ b/include/linux/page-flags-layout.h > > @@ -26,6 +26,14 @@ > > > > #define ZONES_WIDTH ZONES_SHIFT > > > > +#ifdef CONFIG_LRU_GEN > > +/* LRU_GEN_WIDTH is generated from order_base_2(CONFIG_NR_LRU_GENS + 1). */ > > +#define LRU_REFS_WIDTH (CONFIG_TIERS_PER_GEN - 2) > > +#else > > +#define LRU_GEN_WIDTH 0 > > +#define LRU_REFS_WIDTH 0 > > +#endif /* CONFIG_LRU_GEN */ > > I'm concerned about the number of bits being used in page->flags. > It seems to me that we already have six bits in use to aid us in choosing > which pages to reclaim: referenced, lru, active, workingset, reclaim, > unevictable. > > What I was hoping to see from this patch set was reuse of those bits. Agreed. I have a plan to *reduce* some of those bits but it's a relatively low priority item on my to-do list. > That would give us 32 queues in total. Some would be special (eg pages > cannot migrate out of the unevictable queue), but it seems to me that you > effectively have 4 queues for active and 4 queues for inactive at this > point (unless I misunderstood that). I think we need special numbers > for: Not on the LRU and Unevictable, but that still leaves us with 30 > generations to split between active & inactive. > > But maybe we still need some of those bits? Perhaps it's not OK to say > that queue id 0 is !LRU, queue 1 is unevictable, queue #2 is workingset, > queues 3-7 are active, queues 8-15 are various degrees of inactive. > I'm assuming that it's not sensible to have a page that's marked as both > "reclaim" and "workingset", but perhaps it is. > > Anyway, I don't understand this area well enough. I was just hoping > for some simplification. I plan to use the spare bits in folio->lru to indicate which lru list a folio is on, i.e., active/inactive or generations or unevictable. In addition, swapbacked could go to folio->mapping -- we wouldn't need it if there were no MADV_FREE, i.e., it would be equivalent to PageAnon() || shmem_mapping(). These two work items can be done separately and in parallel with everything else that's been going on lately. It'd awesome if somebody volunteers, and I can find some resource from our side to test/review the code so that we can have them done sooner. The rest, in theory, can also be moved to somewhere but, IMO, it's not really worth the effort given the situation isn't dire at the moment. referenced and workingset are already reused between the active/inactive lru and the multigenerational lru; reclaim is reused for readahead, but readahead could be split out as an xa tag; lru is reused for isolation synchronization.