linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Mina Almasry <almasrymina@google.com>
Cc: Huang Ying <ying.huang@intel.com>,
	Yang Shi <yang.shi@linux.alibaba.com>,
	Yosry Ahmed <yosryahmed@google.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	weixugc@google.com, shakeelb@google.com, gthelen@google.com,
	fvdl@google.com, Michal Hocko <mhocko@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <songmuchun@bytedance.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [RFC PATCH V1] mm: Disable demotion from proactive reclaim
Date: Wed, 23 Nov 2022 13:00:35 -0500	[thread overview]
Message-ID: <Y35fw2JSAeAddONg@cmpxchg.org> (raw)
In-Reply-To: <20221122203850.2765015-1-almasrymina@google.com>

Hello Mina,

On Tue, Nov 22, 2022 at 12:38:45PM -0800, Mina Almasry wrote:
> Since commit 3f1509c57b1b ("Revert "mm/vmscan: never demote for memcg
> reclaim""), the proactive reclaim interface memory.reclaim does both
> reclaim and demotion. This is likely fine for us for latency critical
> jobs where we would want to disable proactive reclaim entirely, and is
> also fine for latency tolerant jobs where we would like to both
> proactively reclaim and demote.
> 
> However, for some latency tiers in the middle we would like to demote but
> not reclaim. This is because reclaim and demotion incur different latency
> costs to the jobs in the cgroup. Demoted memory would still be addressable
> by the userspace at a higher latency, but reclaimed memory would need to
> incur a pagefault.
> 
> To address this, I propose having reclaim-only and demotion-only
> mechanisms in the kernel. There are a couple possible
> interfaces to carry this out I considered:
> 
> 1. Disable demotion in the memory.reclaim interface and add a new
>    demotion interface (memory.demote).
> 2. Extend memory.reclaim with a "demote=<int>" flag to configure the demotion
>    behavior in the kernel like so:
>    	- demote=0 would disable demotion from this call.
> 	- demote=1 would allow the kernel to demote if it desires.
> 	- demote=2 would only demote if possible but not attempt any
> 	  other form of reclaim.

Unfortunately, our proactive reclaim stack currently relies on
memory.reclaim doing both. It may not stay like that, but I'm a bit
wary of changing user-visible semantics post-facto.

In patch 2, you're adding a node interface to memory.demote. Can you
add this to memory.reclaim instead? This would allow you to control
demotion and reclaim independently as you please: if you call it on a
node with demotion targets, it will demote; if you call it on a node
without one, it'll reclaim. And current users will remain unaffected.


  parent reply	other threads:[~2022-11-23 18:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 20:38 Mina Almasry
2022-11-22 20:38 ` [RFC PATCH v1] mm: Add memory.demote for proactive demotion only Mina Almasry
2022-11-22 20:38 ` [RFC PATCH v1 3/4] mm: Fix demotion-only scanning anon pages Mina Almasry
2022-11-24  5:27   ` Huang, Ying
2022-11-22 20:38 ` [RFC PATCH v1 4/4] mm: Add nodes= arg to memory.demote Mina Almasry
2022-11-23 18:00 ` Johannes Weiner [this message]
2022-11-23 21:20   ` [RFC PATCH V1] mm: Disable demotion from proactive reclaim Mina Almasry
2022-11-23 21:35     ` Yosry Ahmed
2022-11-23 22:30       ` Johannes Weiner
2022-11-23 23:47         ` Yosry Ahmed
2022-11-23 21:58     ` Johannes Weiner
2022-11-23 22:37       ` Mina Almasry
2022-11-24  5:51       ` Huang, Ying
2022-11-28 22:24         ` Yang Shi
2022-11-29  0:53           ` Huang, Ying
2022-11-29 17:27             ` Yang Shi
2022-11-30  5:31               ` Huang, Ying
2022-11-30 18:49                 ` Yang Shi
2022-12-01  1:51                   ` Huang, Ying
2022-12-01 22:45                     ` Yang Shi
2022-12-02  1:57                       ` Huang, Ying
2022-11-29 18:08         ` Johannes Weiner
2022-11-30  3:55           ` Huang, Ying
2022-12-01 20:40             ` Mina Almasry
2022-12-02  2:01               ` Huang, Ying
2022-12-02  2:06                 ` Mina Almasry
2022-11-30  2:14         ` Mina Almasry
2022-11-30  5:39           ` Huang, Ying
2022-11-30  6:06             ` Mina Almasry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y35fw2JSAeAddONg@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=almasrymina@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=fvdl@google.com \
    --cc=gthelen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=weixugc@google.com \
    --cc=yang.shi@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox