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 2F9DBC433F5 for ; Thu, 7 Apr 2022 22:12:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 794BC6B0072; Thu, 7 Apr 2022 18:12:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 743136B0073; Thu, 7 Apr 2022 18:12:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BB876B0074; Thu, 7 Apr 2022 18:12:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 4A1026B0072 for ; Thu, 7 Apr 2022 18:12:42 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F3ED48249980 for ; Thu, 7 Apr 2022 22:12:31 +0000 (UTC) X-FDA: 79331482902.25.E9A41A0 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by imf05.hostedemail.com (Postfix) with ESMTP id 7F853100005 for ; Thu, 7 Apr 2022 22:12:31 +0000 (UTC) Received: by mail-io1-f46.google.com with SMTP id p135so2654728iod.2 for ; Thu, 07 Apr 2022 15:12:31 -0700 (PDT) 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=62GjerdaAck66OudlovFMoMWV8LkosnjVIBtISAsTok=; b=m2dekUbSBaWg3wdckQk3GkcVHt/A/a6ywrsRC7Zr+OHQ+BkUTgjlNU1vXv6zm/3iaY xxadAcipHmqh0C7F0D9EU7NFc5YAb9FZkVSzEL4+O/jx8yrcYGqW9GM2yIaEnMiFbDZr Dmeep7sExLjsu4JxhO4DuuelqA5rbJ/3cOSonPHCwi4EREyhTBEYbgVQhFVpUUAxAx2w Ut/XMTm8M2y818f4j0tTkICVsLLaYMNiaqyjeMNKx7ad+ovCX2uYckpoN2pt5vcpYAeT 9tJny/n/6viFNEbAyrkzNAxLHvA8tlWWvcytzOJR1OO7iJWyOtRt4oRyF8WK5s9ke1jL DBSg== 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=62GjerdaAck66OudlovFMoMWV8LkosnjVIBtISAsTok=; b=Vm1bc/r3SEXA1w2gqzeTUUfirxuc6oWW3AKigbeoJdhFXKY6dJWAScHE7FFUfYySRU QShjEVMXZaVyBc87bGmnrV/Hjj6Ci2ujNQ4BGo7NO8F14ZMB4/Nz6pKIcMurh2YN1lys ZEgZgp8uGLJFGlSzWVHMtAjfFGkre5WSDL8Ln9Le3RcrKb7MiXFqOM+xRAt2GtknG4WN VEbl33QmYsiXHEwc0n6uOPEFWwrtsUlX/f0yrjFYUueB0xh3UoO9aGlF3yfrfdZr0gOj 63LnB++cRCpe2SLMrBe98I3J9kReNh2LKYnd7kqIv/kUekzT/wqbUm2pdgdMIx/nIR1+ eMzQ== X-Gm-Message-State: AOAM532s+7LIa+kx/9argdGe1MntzIDLIo4h0YkALFkhrkn8ll6iaqDQ VSUEp0w18mzLUoBPIg6djHAUPgTaeQxbUGwWD2yLUQ== X-Google-Smtp-Source: ABdhPJxpAZUHlbMukQnpLndfXFl1Rj5fBAxD3imudhiINhEZ65rRZuJcb7Kl9s6yTOWOiwiRJ4IViP6YLnbs5QZ5zWY= X-Received: by 2002:a02:84c9:0:b0:31a:1cf2:4468 with SMTP id f67-20020a0284c9000000b0031a1cf24468mr8517916jai.31.1649369550638; Thu, 07 Apr 2022 15:12:30 -0700 (PDT) MIME-Version: 1.0 References: <20220331084151.2600229-1-yosryahmed@google.com> <87y20nzyw4.fsf@yhuang6-desk2.ccr.corp.intel.com> <87o81fujdc.fsf@yhuang6-desk2.ccr.corp.intel.com> <87bkxfudrk.fsf@yhuang6-desk2.ccr.corp.intel.com> <215bd7332aee0ed1092bad4d826a42854ebfd04a.camel@linux.intel.com> In-Reply-To: <215bd7332aee0ed1092bad4d826a42854ebfd04a.camel@linux.intel.com> From: Wei Xu Date: Thu, 7 Apr 2022 15:12:19 -0700 Message-ID: Subject: Re: [PATCH resend] memcg: introduce per-memcg reclaim interface To: Tim Chen Cc: "Huang, Ying" , Michal Hocko , Yosry Ahmed , Johannes Weiner , Shakeel Butt , Andrew Morton , David Rientjes , Tejun Heo , Zefan Li , Roman Gushchin , Cgroups , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Linux MM , Jonathan Corbet , Yu Zhao , Dave Hansen , Greg Thelen Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7F853100005 X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=m2dekUbS; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of weixugc@google.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=weixugc@google.com X-Stat-Signature: 1bdbwo63wzgfeiyd6w8hzsuj7mjyk8ht X-HE-Tag: 1649369551-300851 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, Apr 7, 2022 at 2:26 PM Tim Chen wrote: > > On Wed, 2022-04-06 at 10:49 +0800, Huang, Ying wrote: > > > > > > If so, > > > > > > > > # echo A > memory.reclaim > > > > > > > > means > > > > > > > > a) "A" bytes memory are freed from the memcg, regardless demoting is > > > > used or not. > > > > > > > > or > > > > > > > > b) "A" bytes memory are reclaimed from the memcg, some of them may be > > > > freed, some of them may be just demoted from DRAM to PMEM. The total > > > > number is "A". > > > > > > > > For me, a) looks more reasonable. > > > > > > > > > > We can use a DEMOTE flag to control the demotion behavior for > > > memory.reclaim. If the flag is not set (the default), then > > > no_demotion of scan_control can be set to 1, similar to > > > reclaim_pages(). > > > > If we have to use a flag to control the behavior, I think it's better to > > have a separate interface (e.g. memory.demote). But do we really need b)? > > > > > The question is then whether we want to rename memory.reclaim to > > > something more general. I think this name is fine if reclaim-based > > > demotion is an accepted concept. > > > > memory.demote will work for 2 level of memory tiers. But when we have 3 level > of memory (e.g. high bandwidth memory, DRAM and PMEM), > it gets ambiguous again of wheter we sould demote from high bandwidth memory > or DRAM. > > Will something like this be more general? > > echo X > memory_[dram,pmem,hbm].reclaim > > So echo X > memory_dram.reclaim > means that we want to free up X bytes from DRAM for the mem cgroup. > > echo demote > memory_dram.reclaim_policy > > This means that we prefer demotion for reclaim instead > of swapping to disk. > (resending in plain-text, sorry). memory.demote can work with any level of memory tiers if a nodemask argument (or a tier argument if there is a more-explicitly defined, userspace visible tiering representation) is provided. The semantics can be to demote X bytes from these nodes to their next tier. memory_dram/memory_pmem assumes the hardware for a particular memory tier, which is undesirable. For example, it is entirely possible that a slow memory tier is implemented by a lower-cost/lower-performance DDR device connected via CXL.mem, not by PMEM. It is better for this interface to speak in either the NUMA node abstraction or a new tier abstraction. It is also desirable to make this interface stateless, i.e. not to require the setting of memory_dram.reclaim_policy. Any policy can be specified as arguments to the request itself and should only affect that particular request. Wei