[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230223024412.3522465-1-mcgrof@kernel.org>
Date: Wed, 22 Feb 2023 18:44:07 -0800
From: Luis Chamberlain <mcgrof@...nel.org>
To: hughd@...gle.com, akpm@...ux-foundation.org, willy@...radead.org
Cc: linux-mm@...ck.org, p.raghav@...sung.com, dave@...olabs.net,
a.manzanares@...sung.com, yosryahmed@...gle.com, mcgrof@...nel.org,
linux-kernel@...r.kernel.org
Subject: [RFC v2 0/5] tmpfs: add the option to disable swap
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
Powered by blists - more mailing lists