[PATCH 0/2 v9] reclaim file-backed pages given POSIX_FADV_NOREUSE

Jaegeuk Kim posted 2 patches 10 months, 1 week ago
Documentation/ABI/testing/sysfs-fs-f2fs |  7 ++
fs/f2fs/debug.c                         |  3 +
fs/f2fs/f2fs.h                          | 14 +++-
fs/f2fs/file.c                          | 60 +++++++++++++++--
fs/f2fs/inode.c                         | 14 ++++
fs/f2fs/shrinker.c                      | 90 +++++++++++++++++++++++++
fs/f2fs/super.c                         |  1 +
fs/f2fs/sysfs.c                         | 63 +++++++++++++++++
8 files changed, 246 insertions(+), 6 deletions(-)
[PATCH 0/2 v9] reclaim file-backed pages given POSIX_FADV_NOREUSE
Posted by Jaegeuk Kim 10 months, 1 week ago
This patch series does not add new API, but implements POSIX_FADV_NOREUSE where
it keeps the page ranges in the f2fs superblock and add a way for users to
reclaim the pages manually.

Change log from v8:
 - remove new APIs, but use fadvise(POSIX_FADV_NOREUSE)

Jaegeuk Kim (2):
  f2fs: keep POSIX_FADV_NOREUSE ranges
  f2fs: add a sysfs entry to reclaim POSIX_FADV_NOREUSE pages

 Documentation/ABI/testing/sysfs-fs-f2fs |  7 ++
 fs/f2fs/debug.c                         |  3 +
 fs/f2fs/f2fs.h                          | 14 +++-
 fs/f2fs/file.c                          | 60 +++++++++++++++--
 fs/f2fs/inode.c                         | 14 ++++
 fs/f2fs/shrinker.c                      | 90 +++++++++++++++++++++++++
 fs/f2fs/super.c                         |  1 +
 fs/f2fs/sysfs.c                         | 63 +++++++++++++++++
 8 files changed, 246 insertions(+), 6 deletions(-)

-- 
2.48.1.601.g30ceb7b040-goog
Re: [PATCH 0/2 v9] reclaim file-backed pages given POSIX_FADV_NOREUSE
Posted by Christoph Hellwig 10 months ago
This still has a file system sysfs HACK, you're still not Ccing the
right list, etc.

Can you pleae at least try to get it right?

On Wed, Feb 12, 2025 at 02:31:55AM +0000, Jaegeuk Kim wrote:
> This patch series does not add new API, but implements POSIX_FADV_NOREUSE where
> it keeps the page ranges in the f2fs superblock and add a way for users to
> reclaim the pages manually.
> 
> Change log from v8:
>  - remove new APIs, but use fadvise(POSIX_FADV_NOREUSE)
> 
> Jaegeuk Kim (2):
>   f2fs: keep POSIX_FADV_NOREUSE ranges
>   f2fs: add a sysfs entry to reclaim POSIX_FADV_NOREUSE pages
> 
>  Documentation/ABI/testing/sysfs-fs-f2fs |  7 ++
>  fs/f2fs/debug.c                         |  3 +
>  fs/f2fs/f2fs.h                          | 14 +++-
>  fs/f2fs/file.c                          | 60 +++++++++++++++--
>  fs/f2fs/inode.c                         | 14 ++++
>  fs/f2fs/shrinker.c                      | 90 +++++++++++++++++++++++++
>  fs/f2fs/super.c                         |  1 +
>  fs/f2fs/sysfs.c                         | 63 +++++++++++++++++
>  8 files changed, 246 insertions(+), 6 deletions(-)
> 
> -- 
> 2.48.1.601.g30ceb7b040-goog
> 
> 
---end quoted text---
Re: [PATCH 0/2 v9] reclaim file-backed pages given POSIX_FADV_NOREUSE
Posted by Jaegeuk Kim 10 months ago
On 02/18, Christoph Hellwig wrote:
> This still has a file system sysfs HACK, you're still not Ccing the
> right list, etc.
> 
> Can you pleae at least try to get it right?

I was modifying the patch having 1) declaring a static global list, 2) adding
some fields to superblock and inode structures to keep the given range in the
inode through fadvise, 3) adding hooks in evict_inode to handle the list, 4)
exploring which sysfs entry in MM to reclaim them explicitly.

But, I stopped at some point, as it looks not good at all. Moreover, I started
to be questioning why not just doing in F2FS back, given sementically I didn't
change anything  on general behavior of fadvise(POSIX_FADV_NOREUSE), IIUC, which
moves pages back to LRU. In addiiton to that, I'd like to keep the range hint in
a filesystem and provide a sysfs entry to manage the hints additionally.
In addition, I don't think there's rule that filesystem cannot reclaim file-back
pages, as it just uses the exported symbol that all filesystems are using in
various different purpose. Hence, I don't get the point which is wrong.

Thanks,

> 
> On Wed, Feb 12, 2025 at 02:31:55AM +0000, Jaegeuk Kim wrote:
> > This patch series does not add new API, but implements POSIX_FADV_NOREUSE where
> > it keeps the page ranges in the f2fs superblock and add a way for users to
> > reclaim the pages manually.
> > 
> > Change log from v8:
> >  - remove new APIs, but use fadvise(POSIX_FADV_NOREUSE)
> > 
> > Jaegeuk Kim (2):
> >   f2fs: keep POSIX_FADV_NOREUSE ranges
> >   f2fs: add a sysfs entry to reclaim POSIX_FADV_NOREUSE pages
> > 
> >  Documentation/ABI/testing/sysfs-fs-f2fs |  7 ++
> >  fs/f2fs/debug.c                         |  3 +
> >  fs/f2fs/f2fs.h                          | 14 +++-
> >  fs/f2fs/file.c                          | 60 +++++++++++++++--
> >  fs/f2fs/inode.c                         | 14 ++++
> >  fs/f2fs/shrinker.c                      | 90 +++++++++++++++++++++++++
> >  fs/f2fs/super.c                         |  1 +
> >  fs/f2fs/sysfs.c                         | 63 +++++++++++++++++
> >  8 files changed, 246 insertions(+), 6 deletions(-)
> > 
> > -- 
> > 2.48.1.601.g30ceb7b040-goog
> > 
> > 
> ---end quoted text---