Re: [PATCH 3/7] cachefiles: Fix page leak in cachefiles_read_backing_file while vmscan is active
From: David Howells
Date: Sat Dec 01 2018 - 08:36:34 EST
Daniel Axtens <dja@xxxxxxxxxx> wrote:
> > [dhowells: Note that I've removed the clearance and put of newpage as
> > they aren't attested in the commit message and don't appear to actually
> > achieve anything since a new page is only allocated is newpage!=NULL and
> > any residual new page is cleared before returning.]
>
> Sorry I hadn't got back to you on this; I think we also discussed this
> with the Ubuntu kernel team and concluded - as you did - that these
> didn't fix any bugs but did make things seem more consistent.
The idea is that if it fails to use the new page it caches it for the next
iteration of the loop rather than going to the allocator twice. But making
the change you proposed, you should also remove the bit that discards the page
on the way out of the function and probably shouldn't initialise newpage at
the top of the function so that the compiler will let you know about paths
that don't handle it.
David