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 462A5C433F5 for ; Thu, 10 Feb 2022 21:39:29 +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:In-Reply-To:MIME-Version:References: 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=niq8+p4/5PZtXDP8cpEiEN/o8/ctTkfhhcmVh8oCm5E=; b=VqRFQkXvZ1y4EA NT/qT+hzjmxahqrpSsTgRInhx3GBbUwJixWT8XWui7v2W/0l/rX86xqndJsDhccYE5cXVZefQa+5/ qRXjmuJPC187AhzILBJ+LVasAunPTDZGGlKvxaPf68+spEApjqBfahji9CbslIVR1rBp0L01oJbg4 /YeMqLR48GM0HbJG0zj0KBzhZgrmLQ+fK/lWx6avwTLFbS0ZqO6JCIvqpgTWjmWPCxecba7ynLyUP vX2YNhbsq8dijflWYjZbPW6F3yBJ1U6YJZZHre+jQaLFJudxdtfB7tD8t/QL+lSMl7TW0KXE9f9/V l1PgiXLJ8USgm5yvA54Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIH8F-004wwX-HZ; Thu, 10 Feb 2022 21:37:39 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIH8D-004wwQ-Hu for linux-arm-kernel@bombadil.infradead.org; Thu, 10 Feb 2022 21:37:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=yiMGkSWaUlInyUsSv6Ymz5MFl5rNEExeyed6yGoVqQo=; b=UIBM663WVp45nBpTuklKQYIaOO qIqrGLpntoMuj+w0Zjrsb/3bZRZJHEEBxo01/e5j3RYuA16k+JKr4fXCfwg+B99MF5J+1bLJ+Jxsb 3k8e1hjG5sxhZ9+FHYVTUSLLfp6CtesC8oHLlIKQvubiwHmjfQp10vYPT10He77uRiHG23oMbvVaT hbtgH4yrj9vzhechikN/jUpAujlWHmSBPuF4DwpgNoDDB+kk0W8w+9iAabVzgoCun/4jStR/hmaq+ FafNBU3pb8iFAL7unJt95dvc82gwXZa10B2otIddSZzFA2j7wS3Y6c4RwzGAGaj0raGgYGzcSGNPG hk7iEN6w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIH81-009n2P-Of; Thu, 10 Feb 2022 21:37:25 +0000 Date: Thu, 10 Feb 2022 21:37:25 +0000 From: Matthew Wilcox To: Yu Zhao 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-Disposition: inline In-Reply-To: <20220208081902.3550911-5-yuzhao@google.com> 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, Feb 08, 2022 at 01:18:54AM -0700, 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're 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. > > Generation numbers are truncated into order_base_2(MAX_NR_GENS+1) bits > in order to fit into the gen counter in folio->flags. Each truncated > generation number is an index to lrugen->lists[]. The sliding window > technique is used to track at least MIN_NR_GENS and at most > MAX_NR_GENS generations. The gen counter stores (seq%MAX_NR_GENS)+1 > while a page is on one of lrugen->lists[]. Otherwise it stores 0. > > There are two conceptually independent processes (as in the > manufacturing process): "the aging", which produces young generations, > and "the eviction", which consumes old generations. They form a > closed-loop system, i.e., "the page reclaim". Both processes can be > invoked from userspace for the purposes of working set estimation and > proactive reclaim. These features are required to optimize job > scheduling (bin packing) in data centers. The variable size of the > sliding window is designed for such use cases [1][2]. > > To avoid confusions, the terms "hot" and "cold" will be applied to the > multigenerational LRU, as a new convention; the terms "active" and > "inactive" will be applied to the active/inactive LRU, as usual. [...] > +++ 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. 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel