Re: [PATCH v2 0/6] tmpfs: add the option to disable swap

From: haoxin
Date: Tue Mar 21 2023 - 07:37:55 EST



在 2023/3/21 上午5:36, Luis Chamberlain 写道:
On Mon, Mar 20, 2023 at 07:14:22PM +0800, haoxin wrote:
在 2023/3/20 上午4:32, Luis Chamberlain 写道:
On Tue, Mar 14, 2023 at 10:46:28AM +0800, haoxin wrote:
All these series looks good to me and i do some test on my virtual machine
it works well.

so please add Tested-by: Xin Hao<xhao@xxxxxxxxxxxxxxxxx> .

just one question, if tmpfs pagecache occupies a large amount of memory, how
can we ensure successful memory reclamation in case of memory shortage?
If you're disabling swap then you know the only thing you can do is
unmount if you want to help the VM, otherwise the pressure is just
greater for the VM.
Un, what i mean is can we add a priority so that this type of pagecache is
reclaimed last ?
That seems to be a classifier request for something much less aggressive
than mapping_set_unevictable(). My patches *prior* to using mapping_set_unevictable()
are I think closer to what it seems you want, but as noted before by
folks, that also puts unecessary stress on the VM because just fail
reclaim on our writepage().

Instead of just setting the parameter noswap to make it unreclaimed, because
if such pagecache which occupy big part of memory which can not be
reclaimed, it will cause OOM.
You can't simultaneously retain possession of a cake and eat it, too,
once you eat it, its gone and noswap eats the cake because of the
suggestion / decision to follow through with mapping_set_unevictable().

It sounds like you want to make mapping_set_unevictable() optional and
deal with the possible stress incurred writepage() failing?
Yes, Just a personal idea, in any way, the current patch is an excellent implementation,  thank you very much.
Not quite
sure what else to recommend here.

Luis