lkml.org 
[lkml]   [2018]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/fadvise: discard partial pages iff endbyte is also eof
On Wed, Jan 03, 2018 at 02:53:43PM +0800, ??????(Caspar) wrote:
>
>
> > ?? 2017??12??23????12:16?????? <shidao.ytt@alibaba-inc.com> ??????
> >
> > From: "shidao.ytt" <shidao.ytt@alibaba-inc.com>
> >
> > in commit 441c228f817f7 ("mm: fadvise: document the
> > fadvise(FADV_DONTNEED) behaviour for partial pages") Mel Gorman
> > explained why partial pages should be preserved instead of discarded
> > when using fadvise(FADV_DONTNEED), however the actual codes to calcuate
> > end_index was unexpectedly wrong, the code behavior didn't match to the
> > statement in comments; Luckily in another commit 18aba41cbf
> > ("mm/fadvise.c: do not discard partial pages with POSIX_FADV_DONTNEED")
> > Oleg Drokin fixed this behavior
> >
> > Here I come up with a new idea that actually we can still discard the
> > last parital page iff the page-unaligned endbyte is also the end of
> > file, since no one else will use the rest of the page and it should be
> > safe enough to discard.
>
> +akpm...
>
> Hi Mel, Andrew:
>
> Would you please take a look at this patch, to see if this proposal
> is reasonable enough, thanks in advance!
>

I'm backlogged after being out for the Christmas. Superficially the patch
looks ok but I wondered how often it happened in practice as we already
would discard files smaller than a page on DONTNEED. It also requires
that the system call get the exact size of the file correct and would not
discard if the off + len was past the end of the file for whatever reason
(e.g. a stat to read the size, a truncate in parallel and fadvise using
stale data from stat) and that's why the patch looked like it might have
no impact in practice. Is the patch known to help a real workload or is
it motivated by a code inspection?

--
Mel Gorman
SUSE Labs

\
 
 \ /
  Last update: 2018-01-03 11:48    [W:0.114 / U:1.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site