linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC v2 0/5] tmpfs: add the option to disable swap
@ 2023-02-23  2:44 Luis Chamberlain
  2023-02-23  2:44 ` [RFC v2 1/5] shmem: remove check for folio lock on writepage() Luis Chamberlain
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Luis Chamberlain @ 2023-02-23  2:44 UTC (permalink / raw)
  To: hughd, akpm, willy
  Cc: linux-mm, p.raghav, dave, a.manzanares, yosryahmed, mcgrof,
	linux-kernel

This adds noswap support to tmpfs. This follows up the first RFC [0],
you can look at that link for details of the testing done. On this
v2 I've addressed the feedback provided by Matthew Wilcox and Yosry
Ahmed. I've also made some other changes. Changes on this v2:

  o Matthew suggested BUG_ON(!folio_test_locked(folio)) is not needed
    on writepage() callback for shmem so just remove that.
  o Based on Matthew's feedback the inode is set up early as it is not
    reset in case we split the folio. So now we move all the variables
    we can set up really early.
  o shmem writepage() should only be issued on reclaim, so just move
    the WARN_ON_ONCE(!wbc->for_reclaim) early so that the code and
    expectations are easier to read. This also avoid the folio splitting
    in case of that odd case.
  o There are a few cases where the shmem writepage() could possibly
    hit, but in the total_swap_pages we just bail out. We shouldn't be
    splitting the folio then. Likewise for VM_LOCKED case. But for
    a writepage() on a VM_LOCKED case is not expected so we want to
    learn about it so add a WARN_ON_ONCE() on that condition.
  o Based on Yosry Ahmed's feedback the patch which allows tmpfs to
    disable swap now just uses mapping_set_unevictable() on inode
    creation. In that case writepage() should not be called so we
    augment the WARN_ON_ONCE() for writepage() for that case to ensure
    that never happens.

If this all seems peachy I can move this to PATCH form next. I've tested
and indeed just using mapping_set_unevictable() suffices to disable swap
upon inode creation.

[0] https://lkml.kernel.org/r/20230207025259.2522793-1-mcgrof@kernel.org

Luis Chamberlain (5):
  shmem: remove check for folio lock on writepage()
  shmem: set shmem_writepage() variables early
  shmem: move reclaim check early on writepages()
  shmem: skip page split if we're not reclaiming
  shmem: add support to ignore swap

 Documentation/mm/unevictable-lru.rst |  2 +
 include/linux/shmem_fs.h             |  1 +
 mm/shmem.c                           | 68 ++++++++++++++++++----------
 3 files changed, 48 insertions(+), 23 deletions(-)

-- 
2.39.1



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-02-23 19:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-23  2:44 [RFC v2 0/5] tmpfs: add the option to disable swap Luis Chamberlain
2023-02-23  2:44 ` [RFC v2 1/5] shmem: remove check for folio lock on writepage() Luis Chamberlain
2023-02-23  2:44 ` [RFC v2 2/5] shmem: set shmem_writepage() variables early Luis Chamberlain
2023-02-23  2:44 ` [RFC v2 3/5] shmem: move reclaim check early on writepages() Luis Chamberlain
2023-02-23  2:44 ` [RFC v2 4/5] shmem: skip page split if we're not reclaiming Luis Chamberlain
2023-02-23  2:44 ` [RFC v2 5/5] shmem: add support to ignore swap Luis Chamberlain
2023-02-23 12:26   ` Christian Brauner
2023-02-23 15:16     ` Christoph Hellwig
2023-02-23 16:09       ` Christian Brauner
2023-02-23 19:43         ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).