lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACSyD1Ok62n-SF8fGrDQq_JC4SUSvFb-6QjgjnkD9=JacCJiYg@mail.gmail.com>
Date: Thu, 29 Aug 2024 18:37:07 +0800
From: Zhongkun He <hezhongkun.hzk@...edance.com>
To: Michal Hocko <mhocko@...e.com>
Cc: akpm@...ux-foundation.org, hannes@...xchg.org, roman.gushchin@...ux.dev, 
	shakeel.butt@...ux.dev, muchun.song@...ux.dev, lizefan.x@...edance.com, 
	linux-mm@...ck.org, linux-kernel@...r.kernel.org, cgroups@...r.kernel.org
Subject: Re: [External] Re: [RFC PATCH 0/2] Add disable_unmap_file arg to memory.reclaim

On Thu, Aug 29, 2024 at 6:24 PM Michal Hocko <mhocko@...e.com> wrote:
>
> On Thu 29-08-24 18:19:16, Zhongkun He wrote:
> > This patch proposes augmenting the memory.reclaim interface with a
> > disable_unmap_file argument that will skip the mapped pages in
> > that reclaim attempt.
> >
> > For example:
> >
> > echo "2M disable_unmap_file" > /sys/fs/cgroup/test/memory.reclaim
> >
> > will perform reclaim on the test cgroup with no mapped file page.
> >
> > The memory.reclaim is a useful interface. We can carry out proactive
> > memory reclaim in the user space, which can increase the utilization
> > rate of memory.
> >
> > In the actual usage scenarios, we found that when there are sufficient
> > anonymous pages, mapped file pages with a relatively small proportion
> > would still be reclaimed. This is likely to cause an increase in
> > refaults and an increase in task delay, because mapped file pages
> > usually include important executable codes, data, and shared libraries,
> > etc. According to the verified situation, if we can skip this part of
> > the memory, the task delay will be reduced.
>
> Do you have examples of workloads where this is demonstrably helps and
> cannot be tuned via swappiness?

Sorry, I put the test workload in the second patch. Please have a look.

Even if there are sufficient anonymous pages and a small number of
page cache and mapped file pages, mapped file pages will still be reclaimed.
Here is an example of anonymous pages being sufficient but mapped
file pages still being reclaimed:

Swappiness has been set to the maximum value.

cat memory.stat | grep -wE 'anon|file|file_mapped'
anon 3406462976
file 332967936
file_mapped 300302336

echo 1g > memory.reclaim swappiness=200 > memory.reclaim
cat memory.stat | grep -wE 'anon|file|file_mapped'
anon 2613276672
file 52523008
file_mapped 30982144

echo 1g > memory.reclaim swappiness=200 > memory.reclaim
cat memory.stat | grep -wE 'anon|file|file_mapped'
anon 1552130048
file 39759872
file_mapped 20299776

With this patch, the file_mapped pages will be skipped.

echo 1g > memory.reclaim swappiness=200 disable_unmap_file  > memory.reclaim
cat memory.stat | grep -wE 'anon|file|file_mapped'
anon 480059392
file 37978112
file_mapped 20299776



> --
> Michal Hocko
> SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ