Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1098489pxm; Wed, 23 Feb 2022 18:05:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDaR1XNTV0W9MKOmXjdwcSZp+qvbJydS+uxOQxZzfIlRZG5/3wHx4B1g39f5yZ8IMtFjEq X-Received: by 2002:aa7:9199:0:b0:4e1:9243:b625 with SMTP id x25-20020aa79199000000b004e19243b625mr550050pfa.21.1645668345555; Wed, 23 Feb 2022 18:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645668345; cv=none; d=google.com; s=arc-20160816; b=ztQ7Pnrc6rWv2f6+z7W2ofGVvbFj+/UAYIcDQEBZc21GHPpci1bRoX/XK4GJMx0/oM c5jbrW+2D7GzJ8AGhmMpVFrQu++XYrCFBknEvh4cj68Orw08vFEBXTIstGbcJimtrjxT Y8YIHVJKhjB79aP4EKGtTf4F9E7Wo6h0qN6b2NCgAY6kkWeOLb7hHTS4NbD+LkPbtlhd REYTSZFd5YN6Xa3ImT83jKOC1G0KMhcY9eWmxNzUTjR1/E89fONusxk2F9Oc0cc0EbFB PqlKge0wVCm6XpnCn8HoOYML5obtscGlU+fRdNIBux7Ow2g4JoYPHtW003TUvLcTNvYK gHaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DlTEvCMe8gLH8mkJngq0jMMrhF4Rb9J1L2FbOtnoMeA=; b=qvu/I/CYAZFkLNftfSEP4BsgpnoClf2VPP4syBZ8nZgUQ3GBZfoMLudT6rQFMZOqpg UdwGnBxZ2AbsFCUsJZH3Riu1+cFxDD5upl7IqWaYPEqMUHHtMMk2OOB7JUEf9/FgFlmm GlRwVVzNOgVSyBq71Qt/ARTe3O4cZZHt3MEvBHFU+ZGi3TQr9seufj5XeDO5A3KHm36S h4lv0glRpmocm6Iy6n8xS36rfTTp9JWd2FMxA9uPrGnIZfi3dAYkA0mWWE3zLixfI0oa PXq+rLAs3qipQRj+b0EiyvJmFTjqMrPj37t+t6rcIldkR1zDqRvtvONUy3gzGLjE0Ior UxNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=sjYQXiAa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s16si1374068plg.621.2022.02.23.18.05.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 18:05:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=sjYQXiAa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AB693159EB4; Wed, 23 Feb 2022 17:34:50 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229577AbiBXBfP (ORCPT + 99 others); Wed, 23 Feb 2022 20:35:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiBXBfO (ORCPT ); Wed, 23 Feb 2022 20:35:14 -0500 Received: from mail-ua1-x936.google.com (mail-ua1-x936.google.com [IPv6:2607:f8b0:4864:20::936]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 291F013AA0E for ; Wed, 23 Feb 2022 17:34:46 -0800 (PST) Received: by mail-ua1-x936.google.com with SMTP id p33so182276uap.8 for ; Wed, 23 Feb 2022 17:34:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DlTEvCMe8gLH8mkJngq0jMMrhF4Rb9J1L2FbOtnoMeA=; b=sjYQXiAaTh8Pan58Dwbpxw8kVwXQt1oAtAF/M0W1jQ6kHv5MlMXbLhguJMlVQsz2mt 4eif8qTqHSAlzgJNMnMyUMVZy0186FJfeZP8a5XgyewuzQB8LgrY2v/VlIIxYnS5Tvw1 ahrvsWzDtvSalYitjQ/o/WowcaihqDCzMk82kA52tuXXN6+6QBx7m2q3ulEvMJ16uYEz V5ZujsVnuN04sVmFL0PQPdCxfh/nwn5+yzc7DL6LoS+q3O+BFjnSOUMS2VOf/ZURdy8K DDwVwm1IctjAuB6SKRa1QT3xdSHHJFY0rf7QFg88fopcFzkRII9LEpXSGdwirgd0ndLd SQ0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DlTEvCMe8gLH8mkJngq0jMMrhF4Rb9J1L2FbOtnoMeA=; b=hrZESqKqo3SwLOuVrBf9DxSrDZaCemeKOyfWuAaeSYyc/YNTKsmUgtok3QZWatGTH9 UOanXRGEim1aMWxjZd5sMsuXvxWAgd5xd0cZjD+aEOKwdHC+IzablubwN9WpwLbmXCRp 8B64Gt4C3To2pocJAyUcL7EV4j7hxQXtnB5wr0g5S7zcUTJC6VuK6mQRAm7Jm9WZaaJv jDXtVvLKiy4uVoKVLQkKQj/419KrMJqM69MzjZkCa0sj8r1dGFBk6Yt7kX3np85vf2+o ChAVn8ZEu/3G2uuxJYpH8jNKDjtKbL3rV8LOFdhxsLKBrWghkM/MWobVSLAa7JXO0LV7 8C/w== X-Gm-Message-State: AOAM532xBxxSgzukwflnGM9rTDp265+UTC0SVWgQEBt0aP2geA0hokRQ oQpQDy6LA8hIN882fiwvlb+83vv/IJHOKFvIWpOaLg== X-Received: by 2002:ab0:2111:0:b0:341:8339:51b4 with SMTP id d17-20020ab02111000000b00341833951b4mr162619ual.76.1645666485123; Wed, 23 Feb 2022 17:34:45 -0800 (PST) MIME-Version: 1.0 References: <20220208081902.3550911-1-yuzhao@google.com> <20220208081902.3550911-6-yuzhao@google.com> <87bkyy56nv.fsf@yhuang6-desk2.ccr.corp.intel.com> <87y2213wrl.fsf@yhuang6-desk2.ccr.corp.intel.com> In-Reply-To: <87y2213wrl.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Yu Zhao Date: Wed, 23 Feb 2022 18:34:33 -0700 Message-ID: Subject: Re: [PATCH v7 05/12] mm: multigenerational LRU: minimal implementation To: "Huang, Ying" 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 , Matthew Wilcox , Michael Larabel , Mike Rapoport , Rik van Riel , Vlastimil Babka , Will Deacon , 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 , =?UTF-8?Q?Holger_Hoffst=C3=A4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 On Wed, Feb 23, 2022 at 5:59 PM Huang, Ying wrote: > > Yu Zhao writes: > > > On Wed, Feb 23, 2022 at 1:28 AM Huang, Ying wrote: > >> > >> Hi, Yu, > >> > >> Yu Zhao writes: > >> > >> > To avoid confusions, the terms "promotion" and "demotion" will be > >> > applied to the multigenerational LRU, as a new convention; the terms > >> > "activation" and "deactivation" will be applied to the active/inactive > >> > LRU, as usual. > >> > >> In the memory tiering related commits and patchset, for example as follows, > >> > >> commit 668e4147d8850df32ca41e28f52c146025ca45c6 > >> Author: Yang Shi > >> Date: Thu Sep 2 14:59:19 2021 -0700 > >> > >> mm/vmscan: add page demotion counter > >> > >> https://lore.kernel.org/linux-mm/20220221084529.1052339-1-ying.huang@intel.com/ > >> > >> "demote" and "promote" is used for migrating pages between different > >> types of memory. Is it better for us to avoid overloading these words > >> too much to avoid the possible confusion? > > > > Given that LRU and migration are usually different contexts, I think > > we'd be fine, unless we want a third pair of terms. > > This is true before memory tiering is introduced. In systems with > multiple types memory (called memory tiering), LRU is used to identify > pages to be migrated to the slow memory node. Please take a look at > can_demote(), which is called in shrink_page_list(). This sounds clearly two contexts to me. Promotion/demotion (move between generations) while pages are on LRU; or promotion/demotion (migration between nodes) after pages are taken off LRU. Note that promotion/demotion are not used in function names. They are used to describe how MGLRU works, in comparison with the active/inactive LRU. Memory tiering is not within this context. > >> > +static int get_swappiness(struct mem_cgroup *memcg) > >> > +{ > >> > + return mem_cgroup_get_nr_swap_pages(memcg) >= MIN_LRU_BATCH ? > >> > + mem_cgroup_swappiness(memcg) : 0; > >> > +} > >> > >> After we introduced demotion support in Linux kernel. The anonymous > >> pages in the fast memory node could be demoted to the slow memory node > >> via the page reclaiming mechanism as in the following commit. Can you > >> consider that too? > > > > Sure. How do I check whether there is still space on the slow node? > > You can always check the watermark of the slow node. But now, we > actually don't check that (as in demote_page_list()), instead we will > wake up kswapd of the slow node. The intended behavior is something > like, > > DRAM -> PMEM -> disk I'll look into this later -- for now, it's a low priority because there isn't much demand. I'll bump it up if anybody is interested in giving it a try. Meanwhile, please feel free to cook up something if you are interested.