incoming
Subsystems (85)
Andrew Morton
maintainerPATCH 57/69 mm: remove cleancache
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: mm: remove cleancache
Patch series "remove Xen tmem leftovers".
Since the removal of the Xen tmem driver in 2019, the cleancache hooks are entirely unused, as are large parts of frontswap. This series against linux-next (with the folio changes included) removes cleancaches, and cuts down frontswap to the bits actually used by zswap.
This patch (of 13):
The cleancache subsystem is unused since the removal of Xen tmem driver in commit 814bbf49dcd0 ("xen: remove tmem driver").
---
Documentation/vm/cleancache.rst | 296 ----------------------- Documentation/vm/frontswap.rst | 12 Documentation/vm/index.rst | 1 MAINTAINERS | 7 arch/arm/configs/bcm2835_defconfig | 1 arch/arm/configs/qcom_defconfig | 1 arch/m68k/configs/amiga_defconfig | 1 arch/m68k/configs/apollo_defconfig | 1 arch/m68k/configs/atari_defconfig | 1 arch/m68k/configs/bvme6000_defconfig | 1 arch/m68k/configs/hp300_defconfig | 1 arch/m68k/configs/mac_defconfig | 1 arch/m68k/configs/multi_defconfig | 1 arch/m68k/configs/mvme147_defconfig | 1 arch/m68k/configs/mvme16x_defconfig | 1 arch/m68k/configs/q40_defconfig | 1 arch/m68k/configs/sun3_defconfig | 1 arch/m68k/configs/sun3x_defconfig | 1 arch/s390/configs/debug_defconfig | 1 arch/s390/configs/defconfig | 1 block/bdev.c | 5 fs/btrfs/extent_io.c | 10 fs/btrfs/super.c | 2 fs/ext4/readpage.c | 6 fs/ext4/super.c | 3 fs/f2fs/data.c | 13 - fs/mpage.c | 7 fs/ntfs3/ntfs_fs.h | 1 fs/ocfs2/super.c | 2 fs/super.c | 3 include/linux/cleancache.h | 124 --------- include/linux/fs.h | 5 mm/Kconfig | 22 - mm/Makefile | 1 mm/cleancache.c | 315 ------------------------- mm/filemap.c | 11 mm/truncate.c | 15 - 37 files changed, 4 insertions(+), 873 deletions(-)
arch/arm/configs/bcm2835_defconfig renamed from arch/arm/configs/bcm2835_defconfig~mm-remove-cleancache +0 -1
@@ -31,7 +31,6 @@ CONFIG_ARCH_BCM2835=y CONFIG_PREEMPT_VOLUNTARY=y CONFIG_AEABI=y CONFIG_KSM=y -CONFIG_CLEANCACHE=y CONFIG_CMA=y CONFIG_SECCOMP=y CONFIG_KEXEC=y
arch/arm/configs/qcom_defconfig renamed from arch/arm/configs/qcom_defconfig~mm-remove-cleancache +0 -1
@@ -27,7 +27,6 @@ CONFIG_PCIE_QCOM=y CONFIG_SMP=y CONFIG_PREEMPT=y CONFIG_HIGHMEM=y -CONFIG_CLEANCACHE=y CONFIG_ARM_APPENDED_DTB=y CONFIG_ARM_ATAG_DTB_COMPAT=y CONFIG_CPU_IDLE=y
arch/m68k/configs/amiga_defconfig renamed from arch/m68k/configs/amiga_defconfig~mm-remove-cleancache +0 -1
@@ -45,7 +45,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/apollo_defconfig renamed from arch/m68k/configs/apollo_defconfig~mm-remove-cleancache +0 -1
@@ -41,7 +41,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/atari_defconfig renamed from arch/m68k/configs/atari_defconfig~mm-remove-cleancache +0 -1
@@ -48,7 +48,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/bvme6000_defconfig renamed from arch/m68k/configs/bvme6000_defconfig~mm-remove-cleancache +0 -1
@@ -38,7 +38,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/hp300_defconfig renamed from arch/m68k/configs/hp300_defconfig~mm-remove-cleancache +0 -1
@@ -40,7 +40,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/mac_defconfig renamed from arch/m68k/configs/mac_defconfig~mm-remove-cleancache +0 -1
@@ -39,7 +39,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/multi_defconfig renamed from arch/m68k/configs/multi_defconfig~mm-remove-cleancache +0 -1
@@ -59,7 +59,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/mvme147_defconfig renamed from arch/m68k/configs/mvme147_defconfig~mm-remove-cleancache +0 -1
@@ -37,7 +37,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/mvme16x_defconfig renamed from arch/m68k/configs/mvme16x_defconfig~mm-remove-cleancache +0 -1
@@ -38,7 +38,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/q40_defconfig renamed from arch/m68k/configs/q40_defconfig~mm-remove-cleancache +0 -1
@@ -39,7 +39,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/sun3_defconfig renamed from arch/m68k/configs/sun3_defconfig~mm-remove-cleancache +0 -1
@@ -35,7 +35,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/m68k/configs/sun3x_defconfig renamed from arch/m68k/configs/sun3x_defconfig~mm-remove-cleancache +0 -1
@@ -35,7 +35,6 @@ CONFIG_IOSCHED_BFQ=m CONFIG_BINFMT_AOUT=m CONFIG_BINFMT_MISC=m # CONFIG_COMPACTION is not set -CONFIG_CLEANCACHE=y CONFIG_ZPOOL=m CONFIG_NET=y CONFIG_PACKET=y
arch/s390/configs/debug_defconfig renamed from arch/s390/configs/debug_defconfig~mm-remove-cleancache +0 -1
@@ -96,7 +96,6 @@ CONFIG_MEMORY_HOTPLUG=y CONFIG_MEMORY_HOTREMOVE=y CONFIG_KSM=y CONFIG_TRANSPARENT_HUGEPAGE=y -CONFIG_CLEANCACHE=y CONFIG_FRONTSWAP=y CONFIG_CMA_DEBUG=y CONFIG_CMA_DEBUGFS=y
arch/s390/configs/defconfig renamed from arch/s390/configs/defconfig~mm-remove-cleancache +0 -1
@@ -91,7 +91,6 @@ CONFIG_MEMORY_HOTPLUG=y CONFIG_MEMORY_HOTREMOVE=y CONFIG_KSM=y CONFIG_TRANSPARENT_HUGEPAGE=y -CONFIG_CLEANCACHE=y CONFIG_FRONTSWAP=y CONFIG_CMA_SYSFS=y CONFIG_CMA_AREAS=7
block/bdev.c renamed from block/bdev.c~mm-remove-cleancache +0 -5
@@ -24,7 +24,6 @@#include <linux/pseudo_fs.h> #include <linux/uio.h> #include <linux/namei.h> -#include <linux/cleancache.h> #include <linux/part_stat.h> #include <linux/uaccess.h> #include "../fs/internal.h"
@@ -88,10 +87,6 @@ void invalidate_bdev(struct block_devicelru_add_drain_all ();/* make sure all lru add caches are flushed */ invalidate_mapping_pages (mapping,0 ,-1 ); } -/* 99% of the time, we don't need to flush the cleancache on the bdev. -* But, for the strange corners, lets be cautious -*/ -cleancache_invalidate_inode (mapping); }EXPORT_SYMBOL (invalidate_bdev);
Documentation/vm/cleancache.rst deleted +0 -296
296 lines not on this page · raw message
Documentation/vm/frontswap.rst renamed from Documentation/vm/frontswap.rst~mm-remove-cleancache +2 -10
@@ -8,12 +8,6 @@ Frontswap provides a "transcendent memor In some environments, dramatic performance savings may be obtained because swapped pages are saved in RAM (or a RAM-like device) instead of a swap disk. -(Note, frontswap -- and :ref:`cleancache` (merged at 3.0) -- are the "frontends" -and the only necessary changes to the core kernel for transcendent memory; -all other supporting code -- the "backends" -- is implemented as drivers. -See the LWN.net article `Transcendent memory in a nutshell`_ -for a detailed overview of frontswap and related kernel parts) - .. _Transcendent memory in a nutshell: https://lwn.net/Articles/454795/ Frontswap is so named because it can be thought of as the opposite of
@@ -87,11 +81,9 @@ This interface is ideal when data is tra and size (such as with compression) or secretly moved (as might be useful for write-balancing for some RAM-like devices). Swap pages (and evicted page-cache pages) are a great use for this kind of slower-than-RAM- -but-much-faster-than-disk "pseudo-RAM device" and the frontswap (and -cleancache) interface to transcendent memory provides a nice way to read -and write -- and indirectly "name" -- the pages. +but-much-faster-than-disk "pseudo-RAM device". -Frontswap -- and cleancache -- with a fairly small impact on the kernel, +Frontswap with a fairly small impact on the kernel, provides a huge amount of flexibility for more dynamic, flexible RAM utilization in various system configurations:
Documentation/vm/index.rst renamed from Documentation/vm/index.rst~mm-remove-cleancache +0 -1
@@ -15,7 +15,6 @@ algorithms. If you are looking for advi active_mm arch_pgtable_helpers balance - cleancache damon/index free_page_reporting frontswap
fs/btrfs/extent_io.c renamed from fs/btrfs/extent_io.c~mm-remove-cleancache +0 -10
@@ -12,7 +12,6 @@#include <linux/writeback.h> #include <linux/pagevec.h> #include <linux/prefetch.h> -#include <linux/cleancache.h> #include <linux/fsverity.h> #include "misc.h" #include "extent_io.h"
@@ -3578,15 +3577,6 @@ int btrfs_do_readpage(struct page *page, goto out; } -if (!PageUptodate (page)) { -if (cleancache_get_page (page) ==0 ) { -BUG_ON (blocksize !=PAGE_SIZE ); -unlock_extent (tree, start, end); -unlock_page (page); - goto out; - } - } -if (page->index == last_byte >>PAGE_SHIFT ) {size_t zero_offset =offset_in_page (last_byte);
fs/btrfs/super.c renamed from fs/btrfs/super.c~mm-remove-cleancache +0 -2
@@ -23,7 +23,6 @@#include <linux/miscdevice.h> #include <linux/magic.h> #include <linux/slab.h> -#include <linux/cleancache.h> #include <linux/ratelimit.h> #include <linux/crc32c.h> #include <linux/btrfs.h>
@@ -1374,7 +1373,6 @@ static int btrfs_fill_super(struct super goto fail_close; } -cleancache_init_fs (sb); sb->s_flags |=SB_ACTIVE ;return 0 ;
fs/ext4/readpage.c renamed from fs/ext4/readpage.c~mm-remove-cleancache +0 -6
@@ -43,7 +43,6 @@#include <linux/writeback.h> #include <linux/backing-dev.h> #include <linux/pagevec.h> -#include <linux/cleancache.h> #include "ext4.h"
@@ -350,11 +349,6 @@ int ext4_mpage_readpages(struct inode *i }else if (fully_mapped) {SetPageMappedToDisk (page); } -if (fully_mapped && blocks_per_page ==1 && - !PageUptodate (page) &&cleancache_get_page (page) ==0 ) { -SetPageUptodate (page); - goto confused; - }/* * This page will go to BIO. Do we need to send this
fs/ext4/super.c renamed from fs/ext4/super.c~mm-remove-cleancache +0 -3
@@ -39,7 +39,6 @@#include <linux/log2.h> #include <linux/crc16.h> #include <linux/dax.h> -#include <linux/cleancache.h> #include <linux/uaccess.h> #include <linux/iversion.h> #include <linux/unicode.h>
@@ -3149,8 +3148,6 @@ done:EXT4_BLOCKS_PER_GROUP (sb),EXT4_INODES_PER_GROUP (sb), sbi->s_mount_opt, sbi->s_mount_opt2); - -cleancache_init_fs (sb);return err; }
fs/f2fs/data.c renamed from fs/f2fs/data.c~mm-remove-cleancache +0 -13
@@ -18,7 +18,6 @@#include <linux/swap.h> #include <linux/prefetch.h> #include <linux/uio.h> -#include <linux/cleancache.h> #include <linux/sched/signal.h> #include <linux/fiemap.h> #include <linux/iomap.h>
@@ -2035,12 +2034,6 @@ got_it: block_nr = map->m_pblk + block_in_file - map->m_lblk;SetPageMappedToDisk (page); -if (!PageUptodate (page) && (!PageSwapCache (page) && - !cleancache_get_page (page))) { -SetPageUptodate (page); - goto confused; - } -if (!f2fs_is_valid_blkaddr (F2FS_I_SB (inode), block_nr,DATA_GENERIC_ENHANCE_READ )) { ret = -EFSCORRUPTED ;
@@ -2096,12 +2089,6 @@ submit_and_realloc:ClearPageError (page); *last_block_in_bio = block_nr; goto out; -confused: -if (bio) { -__submit_bio (F2FS_I_SB (inode), bio,DATA ); - bio =NULL ; - } -unlock_page (page); out: *bio_ret = bio;return ret;
fs/mpage.c renamed from fs/mpage.c~mm-remove-cleancache +0 -7
@@ -29,7 +29,6 @@#include <linux/writeback.h> #include <linux/backing-dev.h> #include <linux/pagevec.h> -#include <linux/cleancache.h> #include "internal.h" /*
@@ -284,12 +283,6 @@ static struct bio *do_mpage_readpage(strSetPageMappedToDisk (page); } -if (fully_mapped && blocks_per_page ==1 && !PageUptodate (page) && -cleancache_get_page (page) ==0 ) { -SetPageUptodate (page); - goto confused; - } -/* * This page will go to BIO. Do we need to send this BIO off first? */
fs/ntfs3/ntfs_fs.h renamed from fs/ntfs3/ntfs_fs.h~mm-remove-cleancache +0 -1
@@ -11,7 +11,6 @@#include <linux/blkdev.h> #include <linux/buffer_head.h> -#include <linux/cleancache.h> #include <linux/fs.h> #include <linux/highmem.h> #include <linux/kernel.h>
fs/ocfs2/super.c renamed from fs/ocfs2/super.c~mm-remove-cleancache +0 -2
@@ -25,7 +25,6 @@#include <linux/mount.h> #include <linux/seq_file.h> #include <linux/quotaops.h> -#include <linux/cleancache.h> #include <linux/signal.h> #define CREATE_TRACE_POINTS
@@ -2283,7 +2282,6 @@ static int ocfs2_initialize_super(structmlog_errno (status); goto bail; } -cleancache_init_shared_fs (sb); osb->ocfs2_wq =alloc_ordered_workqueue ("ocfs2_wq" ,WQ_MEM_RECLAIM );if (!osb->ocfs2_wq) {
fs/super.c renamed from fs/super.c~mm-remove-cleancache +0 -3
@@ -31,7 +31,6 @@#include <linux/mutex.h> #include <linux/backing-dev.h> #include <linux/rculist_bl.h> -#include <linux/cleancache.h> #include <linux/fscrypt.h> #include <linux/fsnotify.h> #include <linux/lockdep.h>
@@ -260,7 +259,6 @@ static struct super_block *alloc_super(s s->s_time_gran =1000000000 ; s->s_time_min =TIME64_MIN ; s->s_time_max =TIME64_MAX ; - s->cleancache_poolid =CLEANCACHE_NO_POOL ; s->s_shrink.seeks =DEFAULT_SEEKS ; s->s_shrink.scan_objects = super_cache_scan;
@@ -330,7 +328,6 @@ void deactivate_locked_super(struct supe {struct file_system_type *fs = s->s_type;if (atomic_dec_and_test (&s->s_active)) { -cleancache_invalidate_fs (s);unregister_shrinker (&s->s_shrink); fs->kill_sb (s);
include/linux/cleancache.h deleted +0 -124
124 lines not on this page · raw message
include/linux/fs.h renamed from include/linux/fs.h~mm-remove-cleancache +0 -5
@@ -1535,11 +1535,6 @@ struct super_block {const struct dentry_operations *s_d_op;/* default d_op for dentries */ -/* -* Saved pool identifier for cleancache (-1 means none) -*/ -int cleancache_poolid; -struct shrinker s_shrink;/* per-sb shrinker handle */ /* Number of inodes with nlink == 0 but still referenced */
MAINTAINERS renamed from MAINTAINERS~mm-remove-cleancache +0 -7
@@ -4705,13 +4705,6 @@ T: git git://git.kernel.org/pub/scm/linu F: include/linux/cfi.h F: kernel/cfi.c -CLEANCACHE API -M: Konrad Rzeszutek Wilk <[email protected]> -L: [email protected] -S: Maintained -F: include/linux/cleancache.h -F: mm/cleancache.c - CLK API M: Russell King <[email protected]> L: [email protected]
mm/cleancache.c deleted +0 -315
315 lines not on this page · raw message
mm/filemap.c renamed from mm/filemap.c~mm-remove-cleancache +0 -11
@@ -35,7 +35,6 @@#include <linux/cpuset.h> #include <linux/hugetlb.h> #include <linux/memcontrol.h> -#include <linux/cleancache.h> #include <linux/shmem_fs.h> #include <linux/rmap.h> #include <linux/delayacct.h>
@@ -151,16 +150,6 @@ static void filemap_unaccount_folio(stru {long nr; -/* -* if we're uptodate, flush out into the cleancache, otherwise -* invalidate any existing cleancache entries. We can't leave -* stale data around in the cleancache once our page is gone -*/ -if (folio_test_uptodate (folio) &&folio_test_mappedtodisk (folio)) -cleancache_put_page (&folio->page); -else -cleancache_invalidate_page (mapping, &folio->page); -VM_BUG_ON_FOLIO (folio_mapped (folio), folio);if (!IS_ENABLED (CONFIG_DEBUG_VM ) &&unlikely (folio_mapped (folio))) {int mapcount;
mm/Kconfig renamed from mm/Kconfig~mm-remove-cleancache +0 -22
@@ -444,28 +444,6 @@ config USE_PERCPU_NUMA_NODE_ID config HAVE_SETUP_PER_CPU_AREA bool -config CLEANCACHE - bool "Enable cleancache driver to cache clean pages if tmem is present" - help - Cleancache can be thought of as a page-granularity victim cache - for clean pages that the kernel's pageframe replacement algorithm - (PFRA) would like to keep around, but can't since there isn't enough - memory. So when the PFRA "evicts" a page, it first attempts to use - cleancache code to put the data contained in that page into - "transcendent memory", memory that is not directly accessible or - addressable by the kernel and is of unknown and possibly - time-varying size. And when a cleancache-enabled - filesystem wishes to access a page in a file on disk, it first - checks cleancache to see if it already contains it; if it does, - the page is copied into the kernel and a disk access is avoided. - When a transcendent memory driver is available (such as zcache or - Xen transcendent memory), a significant I/O reduction - may be achieved. When none is available, all cleancache calls - are reduced to a single pointer-compare-against-NULL resulting - in a negligible performance hit. - - If unsure, say Y to enable cleancache - config FRONTSWAP bool "Enable frontswap to cache swap pages if tmem is present" depends on SWAP
mm/Makefile renamed from mm/Makefile~mm-remove-cleancache +0 -1
@@ -104,7 +104,6 @@ obj-$(CONFIG_DEBUG_KMEMLEAK) += kmemleak obj-$(CONFIG_DEBUG_RODATA_TEST) += rodata_test.o obj-$(CONFIG_DEBUG_VM_PGTABLE) += debug_vm_pgtable.o obj-$(CONFIG_PAGE_OWNER) += page_owner.o -obj-$(CONFIG_CLEANCACHE) += cleancache.o obj-$(CONFIG_MEMORY_ISOLATION) += page_isolation.o obj-$(CONFIG_ZPOOL) += zpool.o obj-$(CONFIG_ZBUD) += zbud.o
mm/truncate.c renamed from mm/truncate.c~mm-remove-cleancache +2 -13
@@ -22,7 +22,6 @@#include <linux/buffer_head.h> /* grr. try_to_release_page, do_invalidatepage */ #include <linux/shmem_fs.h> -#include <linux/cleancache.h> #include <linux/rmap.h> #include "internal.h"
@@ -264,7 +263,6 @@ bool truncate_inode_partial_folio(struct*/ folio_zero_range (folio, offset, length); -cleancache_invalidate_page (folio->mapping, &folio->page);if (folio_has_private (folio))do_invalidatepage (&folio->page, offset, length);if (!folio_test_large (folio))
@@ -351,7 +349,7 @@ void truncate_inode_pages_range(struct abool same_folio;if (mapping_empty (mapping)) - goto out; +return ;/* * 'start' and 'end' always covers the range of pages to be fully
@@ -442,9 +440,6 @@ void truncate_inode_pages_range(struct afolio_batch_release (&fbatch); index++; } - -out: -cleancache_invalidate_inode (mapping); }EXPORT_SYMBOL (truncate_inode_pages_range);
@@ -498,10 +493,6 @@ void truncate_inode_pages_final(struct axa_unlock_irq (&mapping->i_pages); } -/* -* Cleancache needs notification even if there are no pages or shadow -* entries. -*/ truncate_inode_pages (mapping,0 ); }EXPORT_SYMBOL (truncate_inode_pages_final);
@@ -661,7 +652,7 @@ int invalidate_inode_pages2_range(structint did_range_unmap =0 ;if (mapping_empty (mapping)) - goto out; +return 0 ;folio_batch_init (&fbatch); index = start;
@@ -725,8 +716,6 @@ int invalidate_inode_pages2_range(structif (dax_mapping (mapping)) {unmap_mapping_pages (mapping, start, end - start +1 , false); } -out: -cleancache_invalidate_inode (mapping);return ret; }EXPORT_SYMBOL_GPL (invalidate_inode_pages2_range);
_
Andrew Morton
maintainerPATCH 58/69 frontswap: remove frontswap_writethrough
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: remove frontswap_writethrough
frontswap_writethrough is never called, so remove it.
---
Documentation/vm/frontswap.rst | 6 ------ include/linux/frontswap.h | 1 - mm/frontswap.c | 23 +---------------------- 3 files changed, 1 insertion(+), 29 deletions(-)
Documentation/vm/frontswap.rst renamed from Documentation/vm/frontswap.rst~frontswap-remove-frontswap_writethrough +0 -6
@@ -39,12 +39,6 @@ a disk write and, if the data is later r If a store returns failure, transcendent memory has rejected the data, and the page can be written to swap as usual. -If a backend chooses, frontswap can be configured as a "writethrough -cache" by calling frontswap_writethrough(). In this mode, the reduction -in swap device writes is lost (and also a non-trivial performance advantage) -in order to allow the backend to arbitrarily "reclaim" space used to -store frontswap pages to more completely manage its memory usage. - Note that if a page is stored and the page already exists in transcendent memory (a "duplicate" store), either the store succeeds and the data is overwritten, or the store fails AND the page is invalidated. This ensures stale data may
include/linux/frontswap.h renamed from include/linux/frontswap.h~frontswap-remove-frontswap_writethrough +0 -1
@@ -26,7 +26,6 @@ struct frontswap_ops {extern void frontswap_register_ops (struct frontswap_ops *ops);extern void frontswap_shrink (unsigned long );extern unsigned long frontswap_curr_pages (void ); -extern void frontswap_writethrough (bool );#define FRONTSWAP_HAS_EXCLUSIVE_GETS extern void frontswap_tmem_exclusive_gets (bool );
mm/frontswap.c renamed from mm/frontswap.c~frontswap-remove-frontswap_writethrough +1 -22
@@ -33,16 +33,6 @@ static struct frontswap_ops *frontswap_ofor ((ops) = frontswap_ops; (ops); (ops) = (ops)->next)/* -* If enabled, frontswap_store will return failure even on success. As -* a result, the swap subsystem will always write the page to swap, in -* effect converting frontswap into a writethrough cache. In this mode, -* there is no direct reduction in swap writes, but a frontswap backend -* can unilaterally "reclaim" any pages in use with no data loss, thus -* providing increases control over maximum memory usage due to frontswap. -*/ -static bool frontswap_writethrough_enabled __read_mostly; - -/* * If enabled, the underlying tmem implementation is capable of doing * exclusive gets, so frontswap_load, on a successful tmem_get must * mark the page as no longer in frontswap AND mark it dirty.
@@ -171,15 +161,6 @@ void frontswap_register_ops(struct frontEXPORT_SYMBOL (frontswap_register_ops);/* -* Enable/disable frontswap writethrough (see above). -*/ -void frontswap_writethrough (bool enable) -{ - frontswap_writethrough_enabled = enable; -} -EXPORT_SYMBOL (frontswap_writethrough); - -/* * Enable/disable frontswap exclusive gets (see above). */ void frontswap_tmem_exclusive_gets (bool enable)
@@ -283,9 +264,7 @@ int __frontswap_store(struct page *page) }else {inc_frontswap_failed_stores (); } -if (frontswap_writethrough_enabled) -/* report failure so swap also writes to swap device */ - ret =-1 ; +return ret; }EXPORT_SYMBOL (__frontswap_store);
_
Andrew Morton
maintainerPATCH 59/69 frontswap: remove frontswap_tmem_exclusive_gets
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: remove frontswap_tmem_exclusive_gets
frontswap_tmem_exclusive_gets is never called, so remove it.
---
include/linux/frontswap.h | 2 -- mm/frontswap.c | 23 +---------------------- 2 files changed, 1 insertion(+), 24 deletions(-)
include/linux/frontswap.h renamed from include/linux/frontswap.h~frontswap-remove-frontswap_tmem_exclusive_gets +0 -2
@@ -26,8 +26,6 @@ struct frontswap_ops {extern void frontswap_register_ops (struct frontswap_ops *ops);extern void frontswap_shrink (unsigned long );extern unsigned long frontswap_curr_pages (void ); -#define FRONTSWAP_HAS_EXCLUSIVE_GETS -extern void frontswap_tmem_exclusive_gets (bool );extern bool __frontswap_test (struct swap_info_struct *,pgoff_t );extern void __frontswap_init (unsigned type,unsigned long *map);
mm/frontswap.c renamed from mm/frontswap.c~frontswap-remove-frontswap_tmem_exclusive_gets +1 -22
@@ -32,13 +32,6 @@ static struct frontswap_ops *frontswap_o#define for_each_frontswap_ops (ops) \ for ((ops) = frontswap_ops; (ops); (ops) = (ops)->next) -/* -* If enabled, the underlying tmem implementation is capable of doing -* exclusive gets, so frontswap_load, on a successful tmem_get must -* mark the page as no longer in frontswap AND mark it dirty. -*/ -static bool frontswap_tmem_exclusive_gets_enabled__read_mostly ; -#ifdef CONFIG_DEBUG_FS /* * Counters available via /sys/kernel/debug/frontswap (if debugfs is
@@ -161,15 +154,6 @@ void frontswap_register_ops(struct frontEXPORT_SYMBOL (frontswap_register_ops);/* -* Enable/disable frontswap exclusive gets (see above). -*/ -void frontswap_tmem_exclusive_gets (bool enable) -{ - frontswap_tmem_exclusive_gets_enabled = enable; -} -EXPORT_SYMBOL (frontswap_tmem_exclusive_gets); - -/* * Called when a swap device is swapon'd. */ void __frontswap_init (unsigned type,unsigned long *map)
@@ -296,13 +280,8 @@ int __frontswap_load(struct page *page)if (!ret)/* successful load */ break ; } -if (ret ==0 ) { +if (ret ==0 )inc_frontswap_loads (); -if (frontswap_tmem_exclusive_gets_enabled) { -SetPageDirty (page); -__frontswap_clear (sis, offset); - } - }return ret; }EXPORT_SYMBOL (__frontswap_load);
_
Andrew Morton
maintainerPATCH 60/69 frontswap: remove frontswap_shrink
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: remove frontswap_shrink
frontswap_shrink is never called, so remove it.
---
Documentation/vm/frontswap.rst | 13 ---- include/linux/frontswap.h | 1 mm/frontswap.c | 83 ------------------------------- 3 files changed, 97 deletions(-)
Documentation/vm/frontswap.rst renamed from Documentation/vm/frontswap.rst~frontswap-remove-frontswap_shrink +0 -13
@@ -255,19 +255,6 @@ the old data and ensure that it is no lo swap subsystem then writes the new data to the read swap device, this is the correct course of action to ensure coherency. -* What is frontswap_shrink for? - -When the (non-frontswap) swap subsystem swaps out a page to a real -swap device, that page is only taking up low-value pre-allocated disk -space. But if frontswap has placed a page in transcendent memory, that -page may be taking up valuable real estate. The frontswap_shrink -routine allows code outside of the swap subsystem to force pages out -of the memory managed by frontswap and back into kernel-addressable memory. -For example, in RAMster, a "suction driver" thread will attempt -to "repatriate" pages sent to a remote machine back to the local machine; -this is driven using the frontswap_shrink mechanism when memory pressure -subsides. - * Why does the frontswap patch create the new include file swapfile.h? The frontswap code depends on some swap-subsystem-internal data
include/linux/frontswap.h renamed from include/linux/frontswap.h~frontswap-remove-frontswap_shrink +0 -1
@@ -24,7 +24,6 @@ struct frontswap_ops { };extern void frontswap_register_ops (struct frontswap_ops *ops); -extern void frontswap_shrink (unsigned long );extern unsigned long frontswap_curr_pages (void );extern bool __frontswap_test (struct swap_info_struct *,pgoff_t );
mm/frontswap.c renamed from mm/frontswap.c~frontswap-remove-frontswap_shrink +0 -83
89 lines not on this page · raw message
_
Andrew Morton
maintainerPATCH 61/69 frontswap: remove frontswap_curr_pages
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: remove frontswap_curr_pages
frontswap_curr_pages is never called, so remove it.
---
include/linux/frontswap.h | 1 - mm/frontswap.c | 28 ---------------------------- 2 files changed, 29 deletions(-)
include/linux/frontswap.h renamed from include/linux/frontswap.h~frontswap-remove-frontswap_curr_pages +0 -1
@@ -24,7 +24,6 @@ struct frontswap_ops { };extern void frontswap_register_ops (struct frontswap_ops *ops); -extern unsigned long frontswap_curr_pages (void );extern bool __frontswap_test (struct swap_info_struct *,pgoff_t );extern void __frontswap_init (unsigned type,unsigned long *map);
mm/frontswap.c renamed from mm/frontswap.c~frontswap-remove-frontswap_curr_pages +0 -28
@@ -330,34 +330,6 @@ void __frontswap_invalidate_area(unsigne }EXPORT_SYMBOL (__frontswap_invalidate_area); -static unsigned long __frontswap_curr_pages (void ) -{ -unsigned long totalpages =0 ; -struct swap_info_struct *si =NULL ; - -assert_spin_locked (&swap_lock); -plist_for_each_entry (si, &swap_active_head, list) - totalpages +=atomic_read (&si->frontswap_pages); -return totalpages; -} - -/* -* Count and return the number of frontswap pages across all -* swap devices. This is exported so that backend drivers can -* determine current usage without reading debugfs. -*/ -unsigned long frontswap_curr_pages (void ) -{ -unsigned long totalpages =0 ; - -spin_lock (&swap_lock); - totalpages =__frontswap_curr_pages (); -spin_unlock (&swap_lock); - -return totalpages; -} -EXPORT_SYMBOL (frontswap_curr_pages); -static int __init init_frontswap (void ) {#ifdef CONFIG_DEBUG_FS
_
Andrew Morton
maintainerPATCH 62/69 frontswap: simplify frontswap_init
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: simplify frontswap_init
Just use IS_ENABLED() and remove the __frontswap_init indirection. Also remove the unused export.
---
include/linux/frontswap.h | 9 +-------- mm/frontswap.c | 3 +-- mm/swapfile.c | 3 ++- 3 files changed, 4 insertions(+), 11 deletions(-)
include/linux/frontswap.h renamed from include/linux/frontswap.h~frontswap-simplify-frontswap_init +1 -8
@@ -26,7 +26,7 @@ struct frontswap_ops {extern void frontswap_register_ops (struct frontswap_ops *ops);extern bool __frontswap_test (struct swap_info_struct *,pgoff_t ); -extern void __frontswap_init (unsigned type,unsigned long *map); +extern void frontswap_init (unsigned type,unsigned long *map);extern int __frontswap_store (struct page *page);extern int __frontswap_load (struct page *page);extern void __frontswap_invalidate_page (unsigned ,pgoff_t );
@@ -107,11 +107,4 @@ static inline void frontswap_invalidate_ __frontswap_invalidate_area(type); } -static inline void frontswap_init (unsigned type,unsigned long *map) -{ -#ifdef CONFIG_FRONTSWAP -__frontswap_init (type, map); -#endif -} -#endif /* _LINUX_FRONTSWAP_H */
mm/frontswap.c renamed from mm/frontswap.c~frontswap-simplify-frontswap_init +1 -2
@@ -156,7 +156,7 @@ EXPORT_SYMBOL(frontswap_register_ops);/* * Called when a swap device is swapon'd. */ -void __frontswap_init (unsigned type,unsigned long *map) +void frontswap_init (unsigned type,unsigned long *map) {struct swap_info_struct *sis = swap_info[type];struct frontswap_ops *ops;
@@ -179,7 +179,6 @@ void __frontswap_init(unsigned type, unsfor_each_frontswap_ops (ops) ops->init (type); } -EXPORT_SYMBOL (__frontswap_init);bool __frontswap_test (struct swap_info_struct *sis,pgoff_t offset)
mm/swapfile.c renamed from mm/swapfile.c~frontswap-simplify-frontswap_init +2 -1
@@ -2463,7 +2463,8 @@ static void enable_swap_info(struct swapstruct swap_cluster_info *cluster_info, unsigned long *frontswap_map) { - frontswap_init(p->type, frontswap_map); + if (IS_ENABLED(CONFIG_FRONTSWAP)) + frontswap_init(p->type, frontswap_map); spin_lock(&swap_lock);spin_lock (&p->lock);setup_swap_info (p, prio, swap_map, cluster_info);
_
Andrew Morton
maintainerPATCH 63/69 frontswap: remove the frontswap exports
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: remove the frontswap exports
None of the frontswap API is called from modular code.
---
mm/frontswap.c | 6 ------ 1 file changed, 6 deletions(-)
mm/frontswap.c renamed from mm/frontswap.c~frontswap-remove-the-frontswap-exports +0 -6
@@ -151,7 +151,6 @@ void frontswap_register_ops(struct front } } } -EXPORT_SYMBOL (frontswap_register_ops);/* * Called when a swap device is swapon'd.
@@ -187,7 +186,6 @@ bool __frontswap_test(struct swap_info_sreturn test_bit (offset, sis->frontswap_map);return false; } -EXPORT_SYMBOL (__frontswap_test);static inline void __frontswap_set (struct swap_info_struct *sis,pgoff_t offset)
@@ -250,7 +248,6 @@ int __frontswap_store(struct page *page)return ret; } -EXPORT_SYMBOL (__frontswap_store);/* * "Get" data from frontswap associated with swaptype and offset that were
@@ -283,7 +280,6 @@ int __frontswap_load(struct page *page)inc_frontswap_loads ();return ret; } -EXPORT_SYMBOL (__frontswap_load);/* * Invalidate any data from frontswap associated with the specified swaptype
@@ -305,7 +301,6 @@ void __frontswap_invalidate_page(unsigne__frontswap_clear (sis, offset);inc_frontswap_invalidates (); } -EXPORT_SYMBOL (__frontswap_invalidate_page);/* * Invalidate all data from frontswap associated with all offsets for the
@@ -327,7 +322,6 @@ void __frontswap_invalidate_area(unsigneatomic_set (&sis->frontswap_pages,0 );bitmap_zero (sis->frontswap_map, sis->max); } -EXPORT_SYMBOL (__frontswap_invalidate_area);static int __init init_frontswap (void ) {
_
Andrew Morton
maintainerPATCH 64/69 mm: simplify try_to_unuse
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: mm: simplify try_to_unuse
Remove the unused frontswap and pages_to_unuse arguments, and mark the function static now that the caller in frontswap is gone.
---
include/linux/frontswap.h | 7 --- include/linux/shmem_fs.h | 3 - include/linux/swapfile.h | 1 mm/shmem.c | 33 ++------------ mm/swapfile.c | 83 +++++++++--------------------------- 5 files changed, 30 insertions(+), 97 deletions(-)
include/linux/frontswap.h renamed from include/linux/frontswap.h~mm-simplify-try_to_unuse +0 -7
@@ -7,13 +7,6 @@#include <linux/bitops.h> #include <linux/jump_label.h> -/* -* Return code to denote that requested number of -* frontswap pages are unused(moved to page cache). -* Used in shmem_unuse and try_to_unuse. -*/ -#define FRONTSWAP_PAGES_UNUSED 2 -struct frontswap_ops {void (*init)(unsigned );/* this swap type was just swapon'ed */ int (*store)(unsigned ,pgoff_t ,struct page *);/* store a page */
include/linux/shmem_fs.h renamed from include/linux/shmem_fs.h~mm-simplify-try_to_unuse +1 -2
@@ -83,8 +83,7 @@ extern void shmem_unlock_mapping(structextern struct page *shmem_read_mapping_page_gfp (struct address_space *mapping,pgoff_t index,gfp_t gfp_mask);extern void shmem_truncate_range (struct inode *inode,loff_t start,loff_t end); -extern int shmem_unuse (unsigned int type,bool frontswap, -unsigned long *fs_pages_to_unuse); +int shmem_unuse (unsigned int type);extern bool shmem_is_huge (struct vm_area_struct *vma,struct inode *inode,pgoff_t index);
include/linux/swapfile.h renamed from include/linux/swapfile.h~mm-simplify-try_to_unuse +0 -1
@@ -9,7 +9,6 @@extern spinlock_t swap_lock;extern struct plist_head swap_active_head;extern struct swap_info_struct *swap_info[]; -extern int try_to_unuse (unsigned int ,bool ,unsigned long );extern unsigned long generic_max_swapfile_size (void );extern unsigned long max_swapfile_size (void );
mm/shmem.c renamed from mm/shmem.c~mm-simplify-try_to_unuse +6 -27
@@ -36,7 +36,6 @@#include <linux/uio.h> #include <linux/khugepaged.h> #include <linux/hugetlb.h> -#include <linux/frontswap.h> #include <linux/fs_parser.h> #include <linux/swapfile.h>
@@ -1152,7 +1151,7 @@ static void shmem_evict_inode(struct inostatic int shmem_find_swap_entries (struct address_space *mapping,pgoff_t start,unsigned int nr_entries,struct page **entries,pgoff_t *indices, -unsigned int type,bool frontswap) +unsigned int type) {XA_STATE (xas, &mapping->i_pages, start);struct page *page;
@@ -1173,9 +1172,6 @@ static int shmem_find_swap_entries(struc entry =radix_to_swp_entry (page);if (swp_type (entry) != type)continue ; -if (frontswap && - !frontswap_test (swap_info[type],swp_offset (entry))) -continue ; indices[ret] = xas.xa_index; entries[ret] = page;
@@ -1228,26 +1224,20 @@ static int shmem_unuse_swap_entries(stru/* * If swap found in inode, free it and move page from swapcache to filecache. */ -static int shmem_unuse_inode (struct inode *inode,unsigned int type, -bool frontswap,unsigned long *fs_pages_to_unuse) +static int shmem_unuse_inode (struct inode *inode,unsigned int type) {struct address_space *mapping = inode->i_mapping;pgoff_t start =0 ;struct pagevec pvec;pgoff_t indices[PAGEVEC_SIZE ]; -bool frontswap_partial = (frontswap && *fs_pages_to_unuse >0 );int ret =0 ;pagevec_init (&pvec); do { unsigned int nr_entries = PAGEVEC_SIZE; - if (frontswap_partial && *fs_pages_to_unuse < PAGEVEC_SIZE) - nr_entries = *fs_pages_to_unuse; - pvec.nr = shmem_find_swap_entries(mapping, start, nr_entries, - pvec.pages, indices, - type, frontswap); + pvec.pages, indices, type); if (pvec.nr == 0) { ret = 0; break;
@@ -1257,14 +1247,6 @@ static int shmem_unuse_inode(struct inodif (ret <0 )break ; -if (frontswap_partial) { - *fs_pages_to_unuse -= ret; -if (*fs_pages_to_unuse ==0 ) { - ret =FRONTSWAP_PAGES_UNUSED ; -break ; - } - } - start = indices[pvec.nr -1 ]; }while (true);
@@ -1276,8 +1258,7 @@ static int shmem_unuse_inode(struct inod* device 'type' back into memory, so the swap device can be * unused. */ -int shmem_unuse (unsigned int type,bool frontswap, -unsigned long *fs_pages_to_unuse) +int shmem_unuse (unsigned int type) {struct shmem_inode_info *info, *next;int error =0 ;
@@ -1300,8 +1281,7 @@ int shmem_unuse(unsigned int type, boolatomic_inc (&info->stop_eviction);mutex_unlock (&shmem_swaplist_mutex); - error =shmem_unuse_inode (&info->vfs_inode, type, frontswap, - fs_pages_to_unuse); + error =shmem_unuse_inode (&info->vfs_inode, type);cond_resched ();mutex_lock (&shmem_swaplist_mutex);
@@ -4015,8 +3995,7 @@ int __init shmem_init(void)return 0 ; } -int shmem_unuse (unsigned int type,bool frontswap, -unsigned long *fs_pages_to_unuse) +int shmem_unuse (unsigned int type) {return 0 ; }
mm/swapfile.c renamed from mm/swapfile.c~mm-simplify-try_to_unuse +23 -60
220 lines not on this page · raw message
_
Andrew Morton
maintainerPATCH 65/69 frontswap: remove frontswap_test
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: remove frontswap_test
frontswap_test is unused now, remove it.
---
include/linux/frontswap.h | 11 ----------- mm/frontswap.c | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-)
include/linux/frontswap.h renamed from include/linux/frontswap.h~frontswap-remove-frontswap_test +0 -11
@@ -18,7 +18,6 @@ struct frontswap_ops {extern void frontswap_register_ops (struct frontswap_ops *ops); -extern bool __frontswap_test (struct swap_info_struct *,pgoff_t );extern void frontswap_init (unsigned type,unsigned long *map);extern int __frontswap_store (struct page *page);extern int __frontswap_load (struct page *page);
@@ -33,11 +32,6 @@ static inline bool frontswap_enabled(voireturn static_branch_unlikely (&frontswap_enabled_key); } -static inline bool frontswap_test (struct swap_info_struct *sis,pgoff_t offset) -{ -return __frontswap_test (sis, offset); -} -static inline void frontswap_map_set (struct swap_info_struct *p,unsigned long *map) {
@@ -55,11 +49,6 @@ static inline bool frontswap_enabled(voi {return false; } - -static inline bool frontswap_test (struct swap_info_struct *sis,pgoff_t offset) -{ -return false; -}static inline void frontswap_map_set (struct swap_info_struct *p,unsigned long *map)
mm/frontswap.c renamed from mm/frontswap.c~frontswap-remove-frontswap_test +1 -1
@@ -179,7 +179,7 @@ void frontswap_init(unsigned type, unsig ops->init (type); } -bool __frontswap_test (struct swap_info_struct *sis, +static bool __frontswap_test (struct swap_info_struct *sis,pgoff_t offset) {if (sis->frontswap_map)
_
Andrew Morton
maintainerPATCH 66/69 frontswap: simplify frontswap_register_ops
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: simplify frontswap_register_ops
Given that frontswap_register_ops must be called from built-in code, there is no need to handle the case of swapfiles coming online before or during it, so delete the code that deals with that case.
---
mm/frontswap.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-)
mm/frontswap.c renamed from mm/frontswap.c~frontswap-simplify-frontswap_register_ops +0 -41
@@ -99,25 +99,6 @@ static inline void inc_frontswap_invalid*/ void frontswap_register_ops (struct frontswap_ops *ops) { -DECLARE_BITMAP (a,MAX_SWAPFILES ); -DECLARE_BITMAP (b,MAX_SWAPFILES ); -struct swap_info_struct *si; -unsigned int i; - -bitmap_zero (a,MAX_SWAPFILES ); -bitmap_zero (b,MAX_SWAPFILES ); - -spin_lock (&swap_lock); -plist_for_each_entry (si, &swap_active_head, list) { -if (!WARN_ON (!si->frontswap_map)) -__set_bit (si->type, a); - } -spin_unlock (&swap_lock); - -/* the new ops needs to know the currently active swap devices */ -for_each_set_bit (i, a,MAX_SWAPFILES ) - ops->init (i); -/* * Setting frontswap_ops must happen after the ops->init() calls * above; cmpxchg implies smp_mb() which will ensure the init is
@@ -128,28 +109,6 @@ void frontswap_register_ops(struct front }while (cmpxchg (&frontswap_ops, ops->next, ops) != ops->next);static_branch_inc (&frontswap_enabled_key); - -spin_lock (&swap_lock); -plist_for_each_entry (si, &swap_active_head, list) { -if (si->frontswap_map) -__set_bit (si->type, b); - } -spin_unlock (&swap_lock); - -/* -* On the very unlikely chance that a swap device was added or -* removed between setting the "a" list bits and the ops init -* calls, we re-check and do init or invalidate for any changed -* bits. -*/ -if (unlikely (!bitmap_equal (a, b,MAX_SWAPFILES ))) { -for (i =0 ; i <MAX_SWAPFILES ; i++) { -if (!test_bit (i, a) &&test_bit (i, b)) - ops->init (i); -else if (test_bit (i, a) && !test_bit (i, b)) - ops->invalidate_area (i); - } - } }/*
_
Andrew Morton
maintainerPATCH 67/69 mm: mark swap_lock and swap_active_head static
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: mm: mark swap_lock and swap_active_head static
swap_lock and swap_active_head are only used in swapfile.c, so mark them static.
---
include/linux/swapfile.h | 2 -- mm/swapfile.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)
include/linux/swapfile.h renamed from include/linux/swapfile.h~mm-mark-swap_lock-and-swap_active_head-static +0 -2
@@ -6,8 +6,6 @@* these were static in swapfile.c but frontswap.c needs them and we don't * want to expose them to the dozens of source files that include swap.h */ -extern spinlock_t swap_lock; -extern struct plist_head swap_active_head;extern struct swap_info_struct *swap_info[];extern unsigned long generic_max_swapfile_size (void );extern unsigned long max_swapfile_size (void );
mm/swapfile.c renamed from mm/swapfile.c~mm-mark-swap_lock-and-swap_active_head-static +2 -2
@@ -49,7 +49,7 @@ static bool swap_count_continued(struct unsigned char);static void free_swap_count_continuations (struct swap_info_struct *); -DEFINE_SPINLOCK (swap_lock); +static DEFINE_SPINLOCK (swap_lock);static unsigned int nr_swapfiles;atomic_long_t nr_swap_pages;/*
@@ -71,7 +71,7 @@ static const char Unused_offset[] = "Unu* all active swap_info_structs * protected with swap_lock, and ordered by priority. */ -PLIST_HEAD (swap_active_head); +static PLIST_HEAD (swap_active_head);/* * all available (active, not full) swap_info_structs
_
Andrew Morton
maintainerPATCH 68/69 frontswap: remove support for multiple ops
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: frontswap: remove support for multiple ops
There is only a single instance of frontswap ops in the kernel, so simplify the frontswap code by removing support for multiple operations.
---
include/linux/frontswap.h | 3 -- mm/frontswap.c | 50 ++++++++---------------------------- mm/zswap.c | 8 ++++- 3 files changed, 19 insertions(+), 42 deletions(-)
include/linux/frontswap.h renamed from include/linux/frontswap.h~frontswap-remove-support-for-multiple-ops +1 -2
@@ -13,10 +13,9 @@ struct frontswap_ops {int (*load)(unsigned ,pgoff_t ,struct page *);/* load a page */ void (*invalidate_page)(unsigned ,pgoff_t );/* page no longer needed */ void (*invalidate_area)(unsigned );/* swap type just swapoff'ed */ -struct frontswap_ops *next;/* private pointer to next ops */ }; -extern void frontswap_register_ops (struct frontswap_ops *ops); +int frontswap_register_ops (const struct frontswap_ops *ops);extern void frontswap_init (unsigned type,unsigned long *map);extern int __frontswap_store (struct page *page);
mm/frontswap.c renamed from mm/frontswap.c~frontswap-remove-support-for-multiple-ops +12 -38
127 lines not on this page · raw message
mm/zswap.c renamed from mm/zswap.c~frontswap-remove-support-for-multiple-ops +6 -2
@@ -1378,7 +1378,7 @@ static void zswap_frontswap_init(unsigne zswap_trees[type] = tree; } -static struct frontswap_ops zswap_frontswap_ops = { +static const struct frontswap_ops zswap_frontswap_ops = { .store = zswap_frontswap_store, .load = zswap_frontswap_load, .invalidate_page = zswap_frontswap_invalidate_page,
@@ -1475,11 +1475,15 @@ static int __init init_zswap(void)if (!shrink_wq) goto fallback_fail; -frontswap_register_ops (&zswap_frontswap_ops); + ret =frontswap_register_ops (&zswap_frontswap_ops); +if (ret) + goto destroy_wq;if (zswap_debugfs_init ())pr_warn ("debugfs initialization failed\n" );return 0 ; +destroy_wq: +destroy_workqueue (shrink_wq); fallback_fail:if (pool)zswap_pool_destroy (pool);
_
Andrew Morton
maintainerPATCH 69/69 mm: hide the FRONTSWAP Kconfig symbol
In reply to Andrew MortonFrom: Christoph Hellwig <[email protected]>
Subject: mm: hide the FRONTSWAP Kconfig symbol
Select FRONTSWAP from ZSWAP instead of prompting for it.
---
mm/Kconfig | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
mm/Kconfig renamed from mm/Kconfig~mm-hide-the-frontswap-kconfig-symbol +3 -15
@@ -445,20 +445,7 @@ config HAVE_SETUP_PER_CPU_AREA bool config FRONTSWAP - bool "Enable frontswap to cache swap pages if tmem is present" - depends on SWAP - help - Frontswap is so named because it can be thought of as the opposite - of a "backing" store for a swap device. The data is stored into - "transcendent memory", memory that is not directly accessible or - addressable by the kernel and is of unknown and possibly - time-varying size. When space in transcendent memory is available, - a significant swap I/O reduction may be achieved. When none is - available, all frontswap calls are reduced to a single pointer- - compare-against-NULL resulting in a negligible performance hit - and swap data is stored as normal on the matching swap device. - - If unsure, say Y to enable frontswap. + bool config CMA bool "Contiguous Memory Allocator"
@@ -523,7 +510,8 @@ config MEM_SOFT_DIRTY config ZSWAP bool "Compressed cache for swap pages (EXPERIMENTAL)" - depends on FRONTSWAP && CRYPTO=y + depends on SWAP && CRYPTO=y + select FRONTSWAP select ZPOOL help A lightweight compressed cache for swap pages. It takes
_