linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Michal Hocko <mhocko@suse.com>,
	akpm@linux-foundation.org, hannes@cmpxchg.org,
	 roman.gushchin@linux.dev, shakeelb@google.com,
	muchun.song@linux.dev,  linux-mm@kvack.org
Subject: Re: [RFC PATCH] mm: Add reclaim type to memory.reclaim
Date: Tue, 27 Feb 2024 19:37:02 +0800	[thread overview]
Message-ID: <CALOAHbCCsR0=csNZKLUCj5eD0L3DS_yMT-8ZhBbuD0nJfkbeUQ@mail.gmail.com> (raw)
In-Reply-To: <CAJD7tkZhVtwp9iNcCGqJcnRVNhoWTRfO2m6wXejm8urg6nTZpg@mail.gmail.com>

On Tue, Feb 27, 2024 at 5:44 PM Yosry Ahmed <yosryahmed@google.com> wrote:
>
> On Tue, Feb 27, 2024 at 1:39 AM Yafang Shao <laoar.shao@gmail.com> wrote:
> >
> > On Tue, Feb 27, 2024 at 5:05 PM Michal Hocko <mhocko@suse.com> wrote:
> > >
> > > On Tue 27-02-24 13:48:31, Yafang Shao wrote:
> > > > On Mon, Feb 26, 2024 at 10:05 PM Michal Hocko <mhocko@suse.com> wrote:
> > > [...]
> > > > > > To manage disk
> > > > > > storage efficiently, we employ an agent that identifies container images
> > > > > > eligible for destruction once all instances of that image exit.
> > > > > >
> > > > > > However, during destruction, dealing with directories containing numerous
> > > > > > negative dentries can significantly impact performance.
> > > > >
> > > > > Performance of what. I have to say I am kind of lost here. We are
> > > > > talking about memory or a disk storage?
> > > >
> > > > Removing an empty directory with numerous dentries can significantly
> > > > prolong the process of freeing associated dentries, leading to high
> > > > system CPU usage that adversely affects overall system performance.
> > >
> > > Is there anything that prevents you from reclaiming the memcg you are
> > > about to remove? We do have interfaces for that.
> >
> > Reclaiming numerous dentries through force_empty can also lead to
> > potential issues, which is why we attempt to shrink the slab gradually
> > to mitigate them. However, it's important to note that the underlying
> > causes of the issues in force_empty and rmdir are not identical, as
> > they involve different locks.
> >
> > >
> > > > > > To mitigate this
> > > > > > issue, we aim to proactively reclaim these dentries using a user agent.
> > > > > > Extending the memory.reclaim functionality to specifically target slabs
> > > > > > aligns with our requirements.
> > > > >
> > > > > Matthew has already pointed out that this has been proposed several
> > > > > times already and rejected.
> > > >
> > > > With that being said, we haven't come up with any superior solutions
> > > > compared to the proposals mentioned.
> > > >
> > > > > Dedicated slab shrinking interface is
> > > > > especially tricky because you would need a way to tell which shrinkers
> > > > > to invoke and that would be very kernel version specific.
> > > >
> > > > The persistence of this issue over several years without any
> > > > discernible progress suggests that we might be heading in the wrong
> > > > direction. Perhaps we could consider providing a kernel interface to
> > > > users, allowing them to tailor the reclamation process based on their
> > > > workload requirements.
> > >
> > > There are clear problems identified with type specific reclaim and those
> > > might easily strike back with future changes. Once we put an interface
> > > in place we won't be able remove it and that could lead to problems with
> > > future changes in the memory reclaim.
> >
> > That shouldn't deter us from actively seeking a resolution to an issue
> > that has persisted for tens of years.
> > As observed, numerous memcg interfaces have been deprecated in recent years.
>
> There has been recent work to add a swapiness= argument to
> memory.reclaim to balance between anon and file pages. Adding a type=
> argument together with that is a recipe for eternal confusion. *If* we
> want to support this, we need to have a way to combine these two into
> something more user-friendly.

What if we introduce a new file, like memory.shrink? This could serve
as a foundation for potential future extensions, allowing us to shrink
specific slabs with specific counts.

-- 
Regards
Yafang


  reply	other threads:[~2024-02-27 11:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-25 11:42 [RFC PATCH] mm: Add reclaim type to memory.reclaim Yafang Shao
2024-02-26  4:17 ` Matthew Wilcox
2024-02-26 12:34   ` Yafang Shao
2024-02-26 13:16     ` Matthew Wilcox
2024-02-26 13:56       ` Yafang Shao
2024-02-26 14:04 ` Michal Hocko
2024-02-27  5:48   ` Yafang Shao
2024-02-27  9:05     ` Michal Hocko
2024-02-27  9:39       ` Yafang Shao
2024-02-27  9:43         ` Yosry Ahmed
2024-02-27 11:37           ` Yafang Shao [this message]
2024-02-27 11:40             ` Yosry Ahmed
2024-02-27 11:58               ` Yafang Shao
2024-02-27 12:09                 ` Yafang Shao
2024-02-27 12:12                   ` Yafang Shao
2024-02-27 13:17                     ` Michal Hocko
2024-02-27 14:05                       ` Yafang Shao
2024-02-27  9:45         ` Michal Hocko
2024-02-27 10:06           ` Yafang Shao
2024-02-27 13:20             ` Michal Hocko
2024-02-27 14:03               ` Yafang Shao
2024-02-27 14:51                 ` Yafang Shao

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='CALOAHbCCsR0=csNZKLUCj5eD0L3DS_yMT-8ZhBbuD0nJfkbeUQ@mail.gmail.com' \
    --to=laoar.shao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeelb@google.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;
as well as URLs for NNTP newsgroup(s).