Re: [RFC 0/4] Introduce unbalance proactive reclaim

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




在 2023/11/9 11:15, Huang, Ying 写道:
[Some people who received this message don't often get email from ying.huang@xxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Huan Yang <link@xxxxxxxx> writes:

在 2023/11/8 22:06, Michal Hocko 写道:
[Some people who received this message don't often get email from mhocko@xxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

On Wed 08-11-23 14:58:11, Huan Yang wrote:
In some cases, we need to selectively reclaim file pages or anonymous
pages in an unbalanced manner.

For example, when an application is pushed to the background and frozen,
it may not be opened for a long time, and we can safely reclaim the
application's anonymous pages, but we do not want to touch the file pages.
Could you explain why? And also why do you need to swap out in that
case?
When an application is frozen, it usually means that we predict that
it will not be
used for a long time. In order to proactively save some memory, our
strategy will
choose to compress the application's private data into zram. And we
will also
select some of the cold application data that we think is in zram and
swap it out.

The above operations assume that anonymous pages are private to the
application.
If so, is it better only to reclaim private anonymous pages explicitly?
Yes, in practice, we only proactively compress anonymous pages and do not
want to touch file pages.

However, I like the phrase "Provide mechanisms, not strategies". Maybe letter
zcache can use well, we can also proactively compress certain file pages at
a lower cost.

So, maybe give a way to only reclaim page cache is good?

Add another option for that?

But, yes, I also believe that providing a way to specify the tendency to reclaim
anonymous and file types can achieve a certain degree of flexibility.
And swappiness-based control is currently not very accurate.


After the application is frozen, compressing these pages into zram can
save memory
to some extent without worrying about frequent refaults.

And the cost of refaults on zram is lower than that of IO.
If so, swappiness should be high system-wise?

Yes, I agree. Swappiness should not be used to control unbalanced reclamation.

Moreover, this patchset actually use flags to control unbalanced reclamation.

Therefore, the proactive reclamation interface should receive additional options
(such as anon, file) instead of swappiness.


--
Best Regards,
Huang, Ying

This patchset extends the proactive reclaim interface to achieve
unbalanced reclamation. Users can control the reclamation tendency by
inputting swappiness under the original interface. Specifically, users
can input special values to extremely reclaim specific pages.
Other have already touched on this in other replies but v2 doesn't have
a per-memcg swappiness

Example:
        echo "1G" 200 > memory.reclaim (only reclaim anon)
          echo "1G" 0  > memory.reclaim (only reclaim file)
          echo "1G" 1  > memory.reclaim (only reclaim file)

Note that when performing unbalanced reclamation, the cgroup swappiness
will be temporarily adjusted dynamically to the input value. Therefore,
if the cgroup swappiness is further modified during runtime, there may
be some errors.
In general this is a bad semantic. The operation shouldn't have side
effect that are potentially visible for another operation.
So, maybe pass swappiness into sc and keep a single reclamation ensure that
swappiness is not changed?
Or, it's a bad idea that use swappiness to control unbalance reclaim.
--
Michal Hocko
SUSE Labs




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux