Re: [PATCH mmotm v2] tmpfs: do not allocate pages on read

From: Hugh Dickins
Date: Tue Mar 08 2022 - 16:46:27 EST


On Tue, 8 Mar 2022, Darrick J. Wong wrote:
>
> I've long wondered (for my own nefarious purposes) why tmpfs files
> didn't just grab the zero page,

(tmpfs files have been using the zero page for reads for many years:
it was just this odd internal "could it be for a stacking filesystem?"
case, which /dev/loop also fell into, which was doing allocation on read.

I wonder what your nefarious purposes are ;) Maybe related to pages
faulted into an mmap: those pages tmpfs has always allocated for, then
they're freed up later by page reclaim if still undirtied. We may change
that in future, and use the zero page even there: there are advantages
of course, but some care and code needed - never been a priority.)

> so:
>
> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx>

Thanks,
Hugh