| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/07/05 14:30 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch is a pure refactoring that renames mm/swap.c to mm/folio.c, moves internal declarations from include/linux/swap.h to mm/internal.h, and moves the page-cluster sysctl initialization to mm/swap_state.c. It does not introduce any functional changes to the kernel logic.",
"WorthFuzzing": false
} |
| 1/1 | 2026/07/05 14:30 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 0f971938b96ddf3c0d6966adb030463fa95002a2\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Sun Jul 5 14:30:46 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-guide/sysctl/vm.rst\nindex 22cc54cac3b21d..5b318d17aa4b44 100644\n--- a/Documentation/admin-guide/sysctl/vm.rst\n+++ b/Documentation/admin-guide/sysctl/vm.rst\n@@ -19,9 +19,6 @@ The files in this directory can be used to tune the operation\n of the virtual memory (VM) subsystem of the Linux kernel and\n the writeout of dirty data to disk.\n \n-Default values and initialization routines for most of these\n-files can be found in mm/swap.c.\n-\n Currently, these files are in /proc/sys/vm:\n \n - admin_reserve_kbytes\ndiff --git a/Documentation/core-api/mm-api.rst b/Documentation/core-api/mm-api.rst\nindex 4df7d5edbee559..c1d03a5a2a192e 100644\n--- a/Documentation/core-api/mm-api.rst\n+++ b/Documentation/core-api/mm-api.rst\n@@ -118,7 +118,7 @@ More Memory Management Functions\n .. #kernel-doc:: mm/hmm.c (build warnings)\n .. kernel-doc:: mm/memremap.c\n .. kernel-doc:: mm/hugetlb.c\n-.. kernel-doc:: mm/swap.c\n+.. kernel-doc:: mm/folio.c\n .. kernel-doc:: mm/memcontrol.c\n .. #kernel-doc:: mm/memory-tiers.c (build warnings)\n .. kernel-doc:: mm/shmem.c\ndiff --git a/MAINTAINERS b/MAINTAINERS\nindex 29c302e9c17ba3..e853622a9b96ab 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -17086,7 +17086,7 @@ F:\tDocumentation/admin-guide/mm/multigen_lru.rst\n F:\tDocumentation/mm/multigen_lru.rst\n F:\tinclude/linux/mm_inline.h\n F:\tinclude/linux/mmzone.h\n-F:\tmm/swap.c\n+F:\tmm/folio.c\n F:\tmm/vmscan.c\n F:\tmm/workingset.c\n \n@@ -17237,7 +17237,6 @@ F:\tinclude/linux/swap.h\n F:\tinclude/linux/swapfile.h\n F:\tinclude/linux/swapops.h\n F:\tmm/page_io.c\n-F:\tmm/swap.c\n F:\tmm/swap.h\n F:\tmm/swap_table.h\n F:\tmm/swap_state.c\ndiff --git a/include/linux/swap.h b/include/linux/swap.h\nindex 3f31b6a56788c2..696ed01709c2ba 100644\n--- a/include/linux/swap.h\n+++ b/include/linux/swap.h\n@@ -287,39 +287,19 @@ static inline swp_entry_t page_swap_entry(struct page *page)\n \treturn entry;\n }\n \n-/* linux/mm/workingset.c */\n-bool workingset_test_recent(void *shadow, bool file, bool *workingset,\n-\t\t\t\tbool flush);\n-void workingset_age_nonresident(struct lruvec *lruvec, unsigned long nr_pages);\n-void *workingset_eviction(struct folio *folio, struct mem_cgroup *target_memcg);\n-void workingset_refault(struct folio *folio, void *shadow);\n-void workingset_activation(struct folio *folio);\n-\n /* linux/mm/page_alloc.c */\n extern unsigned long totalreserve_pages;\n \n /* Definition of global_zone_page_state not available yet */\n #define nr_free_pages() global_zone_page_state(NR_FREE_PAGES)\n \n+/* linux/mm/folio.c */\n+void folio_add_lru(struct folio *folio);\n+void folio_mark_accessed(struct folio *folio);\n+void lru_add_drain_all(void);\n \n-/* linux/mm/swap.c */\n-void lru_note_cost_unlock_irq(struct lruvec *lruvec, bool file,\n-\t\tunsigned int nr_io, unsigned int nr_rotated);\n-void lru_note_cost_refault(struct folio *);\n-void folio_add_lru(struct folio *);\n-void folio_add_lru_vma(struct folio *, struct vm_area_struct *);\n-void mark_page_accessed(struct page *);\n-void folio_mark_accessed(struct folio *);\n-\n-static inline bool folio_may_be_lru_cached(struct folio *folio)\n-{\n-\t/*\n-\t * Holding PMD-sized folios in per-CPU LRU cache unbalances accounting.\n-\t * Holding small numbers of low-order mTHP folios in per-CPU LRU cache\n-\t * will be sensible, but nobody has implemented and tested that yet.\n-\t */\n-\treturn !folio_test_large(folio);\n-}\n+/* linux/mm/folio-compat.c */\n+void mark_page_accessed(struct page *page);\n \n extern atomic_t lru_disable_count;\n \n@@ -328,43 +308,6 @@ static inline bool lru_cache_disabled(void)\n \treturn atomic_read(\u0026lru_disable_count);\n }\n \n-static inline void lru_cache_enable(void)\n-{\n-\tatomic_dec(\u0026lru_disable_count);\n-}\n-\n-extern void lru_cache_disable(void);\n-extern void lru_add_drain(void);\n-extern void lru_add_drain_cpu(int cpu);\n-extern void lru_add_drain_cpu_zone(struct zone *zone);\n-extern void lru_add_drain_all(void);\n-void folio_deactivate(struct folio *folio);\n-void folio_mark_lazyfree(struct folio *folio);\n-extern void swap_setup(void);\n-\n-/* linux/mm/vmscan.c */\n-extern unsigned long zone_reclaimable_pages(struct zone *zone);\n-extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,\n-\t\t\t\t\tgfp_t gfp_mask, const nodemask_t *mask);\n-unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx);\n-\n-#define MEMCG_RECLAIM_MAY_SWAP (1 \u003c\u003c 1)\n-#define MEMCG_RECLAIM_PROACTIVE (1 \u003c\u003c 2)\n-#define MIN_SWAPPINESS 0\n-#define MAX_SWAPPINESS 200\n-\n-/* Just reclaim from anon folios in proactive memory reclaim */\n-#define SWAPPINESS_ANON_ONLY (MAX_SWAPPINESS + 1)\n-\n-extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,\n-\t\t\t\t\t\t unsigned long nr_pages,\n-\t\t\t\t\t\t gfp_t gfp_mask,\n-\t\t\t\t\t\t unsigned int reclaim_options,\n-\t\t\t\t\t\t int *swappiness);\n-extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem,\n-\t\t\t\t\t\tgfp_t gfp_mask, bool noswap,\n-\t\t\t\t\t\tpg_data_t *pgdat,\n-\t\t\t\t\t\tunsigned long *nr_scanned);\n extern unsigned long shrink_all_memory(unsigned long nr_pages);\n extern int vm_swappiness;\n long remove_mapping(struct address_space *mapping, struct folio *folio);\n@@ -385,11 +328,6 @@ static inline void reclaim_unregister_node(struct node *node)\n }\n #endif /* CONFIG_SYSFS \u0026\u0026 CONFIG_NUMA */\n \n-#ifdef CONFIG_NUMA\n-extern int sysctl_min_unmapped_ratio;\n-extern int sysctl_min_slab_ratio;\n-#endif\n-\n void check_move_unevictable_folios(struct folio_batch *fbatch);\n \n extern void __meminit kswapd_run(int nid);\n@@ -545,7 +483,7 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)\n \n void lru_reparent_memcg(struct mem_cgroup *memcg, struct mem_cgroup *parent, int nid);\n #else\n-static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)\n+static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)\n {\n \treturn READ_ONCE(vm_swappiness);\n }\ndiff --git a/mm/Makefile b/mm/Makefile\nindex 4fc713867b9bd8..8e7e964b99a478 100644\n--- a/mm/Makefile\n+++ b/mm/Makefile\n@@ -50,7 +50,7 @@ endif\n \n obj-y\t\t\t:= filemap.o mempool.o oom_kill.o fadvise.o \\\n \t\t\t maccess.o page-writeback.o folio-compat.o \\\n-\t\t\t readahead.o swap.o truncate.o vmscan.o shrinker.o \\\n+\t\t\t readahead.o folio.o truncate.o vmscan.o shrinker.o \\\n \t\t\t shmem.o util.o mmzone.o vmstat.o backing-dev.o \\\n \t\t\t mm_init.o percpu.o slab_common.o \\\n \t\t\t compaction.o show_mem.o \\\ndiff --git a/mm/swap.c b/mm/folio.c\nsimilarity index 96%\nrename from mm/swap.c\nrename to mm/folio.c\nindex 58e4eff698cc4e..4acad3e94cbd00 100644\n--- a/mm/swap.c\n+++ b/mm/folio.c\n@@ -1,17 +1,13 @@\n // SPDX-License-Identifier: GPL-2.0-only\n /*\n- * linux/mm/swap.c\n+ * linux/mm/folio.c\n *\n * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds\n */\n \n /*\n- * This file contains the default values for the operation of the\n- * Linux VM subsystem. Fine-tuning documentation can be found in\n- * Documentation/admin-guide/sysctl/vm.rst.\n- * Started 18.12.91\n- * Swap aging added 23.2.95, Stephen Tweedie.\n- * Buffermem limits added 12.3.98, Rik van Riel.\n+ * Folio LRU helpers: add/remove folios from LRU lists, batching,\n+ * activation/deactivation, and page cache release paths.\n */\n \n #include \u003clinux/mm.h\u003e\n@@ -43,10 +39,6 @@\n #define CREATE_TRACE_POINTS\n #include \u003ctrace/events/pagemap.h\u003e\n \n-/* How many pages do we try to swap or page in/out together? As a power of 2 */\n-int page_cluster;\n-static const int page_cluster_max = 31;\n-\n struct cpu_fbatches {\n \t/*\n \t * The following folio batches are grouped together because they are protected\n@@ -1176,35 +1168,3 @@ void lru_reparent_memcg(struct mem_cgroup *memcg, struct mem_cgroup *parent, int\n \t\tlruvec_reparent_lru(child_lruvec, parent_lruvec, lru, nid);\n }\n #endif\n-\n-static const struct ctl_table swap_sysctl_table[] = {\n-\t{\n-\t\t.procname\t= \"page-cluster\",\n-\t\t.data\t\t= \u0026page_cluster,\n-\t\t.maxlen\t\t= sizeof(int),\n-\t\t.mode\t\t= 0644,\n-\t\t.proc_handler\t= proc_dointvec_minmax,\n-\t\t.extra1\t\t= SYSCTL_ZERO,\n-\t\t.extra2\t\t= (void *)\u0026page_cluster_max,\n-\t}\n-};\n-\n-/*\n- * Perform any setup for the swap system\n- */\n-void __init swap_setup(void)\n-{\n-\tunsigned long megs = PAGES_TO_MB(totalram_pages());\n-\n-\t/* Use a smaller cluster for small-memory machines */\n-\tif (megs \u003c 16)\n-\t\tpage_cluster = 2;\n-\telse\n-\t\tpage_cluster = 3;\n-\t/*\n-\t * Right now other parts of the system means that we\n-\t * _really_ don't want to cluster much more\n-\t */\n-\n-\tregister_sysctl_init(\"vm\", swap_sysctl_table);\n-}\ndiff --git a/mm/internal.h b/mm/internal.h\nindex fa4fb69444ecdc..771bd3581fc7ac 100644\n--- a/mm/internal.h\n+++ b/mm/internal.h\n@@ -31,6 +31,73 @@ struct huge_bootmem_page {\n \tunsigned long flags;\n };\n \n+/* mm/workingset.c */\n+bool workingset_test_recent(void *shadow, bool file, bool *workingset,\n+\t\t\t bool flush);\n+void workingset_age_nonresident(struct lruvec *lruvec, unsigned long nr_pages);\n+void *workingset_eviction(struct folio *folio,\n+\t\t\t struct mem_cgroup *target_memcg);\n+void workingset_refault(struct folio *folio, void *shadow);\n+void workingset_activation(struct folio *folio);\n+\n+/* mm/folio.c */\n+void lru_note_cost_unlock_irq(struct lruvec *lruvec, bool file,\n+\t\tunsigned int nr_io, unsigned int nr_rotated);\n+void lru_note_cost_refault(struct folio *folio);\n+void folio_add_lru_vma(struct folio *folio, struct vm_area_struct *vma);\n+\n+static inline bool folio_may_be_lru_cached(struct folio *folio)\n+{\n+\t/*\n+\t * Holding PMD-sized folios in per-CPU LRU cache unbalances accounting.\n+\t * Holding small numbers of low-order mTHP folios in per-CPU LRU cache\n+\t * will be sensible, but nobody has implemented and tested that yet.\n+\t */\n+\treturn !folio_test_large(folio);\n+}\n+\n+static inline void lru_cache_enable(void)\n+{\n+\tatomic_dec(\u0026lru_disable_count);\n+}\n+\n+void lru_cache_disable(void);\n+void lru_add_drain(void);\n+void lru_add_drain_cpu(int cpu);\n+void lru_add_drain_cpu_zone(struct zone *zone);\n+void folio_deactivate(struct folio *folio);\n+void folio_mark_lazyfree(struct folio *folio);\n+\n+/* mm/vmscan.c */\n+unsigned long zone_reclaimable_pages(struct zone *zone);\n+unsigned long try_to_free_pages(struct zonelist *zonelist, int order,\n+\t\t\t\tgfp_t gfp_mask, const nodemask_t *mask);\n+unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru,\n+\t\t\t int zone_idx);\n+\n+#define MEMCG_RECLAIM_MAY_SWAP (1 \u003c\u003c 1)\n+#define MEMCG_RECLAIM_PROACTIVE (1 \u003c\u003c 2)\n+#define MIN_SWAPPINESS 0\n+#define MAX_SWAPPINESS 200\n+\n+/* Just reclaim from anon folios in proactive memory reclaim */\n+#define SWAPPINESS_ANON_ONLY (MAX_SWAPPINESS + 1)\n+\n+unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,\n+\t\t\t\t\t unsigned long nr_pages,\n+\t\t\t\t\t gfp_t gfp_mask,\n+\t\t\t\t\t unsigned int reclaim_options,\n+\t\t\t\t\t int *swappiness);\n+unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg,\n+\t\t\t\t gfp_t gfp_mask, bool noswap,\n+\t\t\t\t pg_data_t *pgdat,\n+\t\t\t\t unsigned long *nr_scanned);\n+\n+#ifdef CONFIG_NUMA\n+extern int sysctl_min_unmapped_ratio;\n+extern int sysctl_min_slab_ratio;\n+#endif\n+\n /*\n * Maintains state across a page table move. The operation assumes both source\n * and destination VMAs already exist and are specified by the user.\ndiff --git a/mm/memfd.c b/mm/memfd.c\nindex abe13b291ddc8b..6c72fe6caef75d 100644\n--- a/mm/memfd.c\n+++ b/mm/memfd.c\n@@ -19,6 +19,7 @@\n #include \u003clinux/memfd.h\u003e\n #include \u003clinux/pid_namespace.h\u003e\n #include \u003cuapi/linux/memfd.h\u003e\n+#include \"internal.h\"\n #include \"swap.h\"\n \n /*\ndiff --git a/mm/swap.h b/mm/swap.h\nindex 44ab8e1e595b08..624ea8ff3d0d55 100644\n--- a/mm/swap.h\n+++ b/mm/swap.h\n@@ -8,8 +8,6 @@ struct mempolicy;\n struct swap_iocb;\n struct swap_memcg_table;\n \n-extern int page_cluster;\n-\n #if defined(MAX_POSSIBLE_PHYSMEM_BITS)\n #define SWAP_CACHE_PFN_BITS (MAX_POSSIBLE_PHYSMEM_BITS - PAGE_SHIFT)\n #elif defined(MAX_PHYSMEM_BITS)\n@@ -79,6 +77,8 @@ enum swap_cluster_flags {\n };\n \n #ifdef CONFIG_SWAP\n+void swap_readahead_setup(void);\n+\n #include \u003clinux/swapops.h\u003e /* for swp_offset */\n #include \u003clinux/blk_types.h\u003e /* for bio_end_io_t */\n \n@@ -336,6 +336,11 @@ static inline unsigned int folio_swap_flags(struct folio *folio)\n \n #else /* CONFIG_SWAP */\n struct swap_iocb;\n+\n+static inline void swap_readahead_setup(void)\n+{\n+}\n+\n static inline struct swap_cluster_info *swap_cluster_lock(\n \tstruct swap_info_struct *si, pgoff_t offset, bool irq)\n {\ndiff --git a/mm/swap_state.c b/mm/swap_state.c\nindex 6fd6e3415b718b..a9f5b944172b2c 100644\n--- a/mm/swap_state.c\n+++ b/mm/swap_state.c\n@@ -22,10 +22,15 @@\n #include \u003clinux/vmalloc.h\u003e\n #include \u003clinux/huge_mm.h\u003e\n #include \u003clinux/shmem_fs.h\u003e\n+#include \u003clinux/sysctl.h\u003e\n #include \"internal.h\"\n #include \"swap_table.h\"\n #include \"swap.h\"\n \n+/* Swap readahead cluster size, as a power of 2 pages. */\n+static int page_cluster;\n+static const int page_cluster_max = 31;\n+\n /*\n * swapper_space is a fiction, retained to simplify the path through\n * vmscan's shrink_folio_list.\n@@ -985,6 +990,38 @@ struct folio *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask,\n \treturn folio;\n }\n \n+static const struct ctl_table swap_readahead_sysctl_table[] = {\n+\t{\n+\t\t.procname\t= \"page-cluster\",\n+\t\t.data\t\t= \u0026page_cluster,\n+\t\t.maxlen\t\t= sizeof(int),\n+\t\t.mode\t\t= 0644,\n+\t\t.proc_handler\t= proc_dointvec_minmax,\n+\t\t.extra1\t\t= SYSCTL_ZERO,\n+\t\t.extra2\t\t= (void *)\u0026page_cluster_max,\n+\t}\n+};\n+\n+/**\n+ * swap_readahead_setup - defaults and sysctl for swap cache readahead clustering\n+ */\n+void __init swap_readahead_setup(void)\n+{\n+\tunsigned long megs = PAGES_TO_MB(totalram_pages());\n+\n+\t/* Use a smaller cluster for small-memory machines */\n+\tif (megs \u003c 16)\n+\t\tpage_cluster = 2;\n+\telse\n+\t\tpage_cluster = 3;\n+\t/*\n+\t * Right now other parts of the system means that we\n+\t * _really_ don't want to cluster much more\n+\t */\n+\n+\tregister_sysctl_init(\"vm\", swap_readahead_sysctl_table);\n+}\n+\n #ifdef CONFIG_SYSFS\n static ssize_t vma_ra_enabled_show(struct kobject *kobj,\n \t\t\t\t struct kobj_attribute *attr, char *buf)\ndiff --git a/mm/vmscan.c b/mm/vmscan.c\nindex f40cfe9d703b3e..ae710027d546f0 100644\n--- a/mm/vmscan.c\n+++ b/mm/vmscan.c\n@@ -7646,7 +7646,7 @@ static int __init kswapd_init(void)\n {\n \tint nid;\n \n-\tswap_setup();\n+\tswap_readahead_setup();\n \tfor_each_node_state(nid, N_MEMORY)\n \t\tkswapd_run(nid);\n \tregister_sysctl_init(\"vm\", vmscan_sysctl_table);\n"
} |
| 2/1 | 2026/07/05 14:30 | agent | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch is a pure refactoring that renames mm/swap.c to mm/folio.c, moves internal declarations from include/linux/swap.h to mm/internal.h, and moves the page-cluster sysctl initialization to mm/swap_state.c. It does not introduce any functional changes to the kernel logic.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Do not list too generic configs (we already have them enabled). Only list those that specifically cover the modified code. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit 0f971938b96ddf3c0d6966adb030463fa95002a2
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Jul 5 14:30:46 2026 +0000
syz-cluster: applied patch under review
diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-guide/sysctl/vm.rst
index 22cc54cac3b21d..5b318d17aa4b44 100644
--- a/Documentation/admin-guide/sysctl/vm.rst
+++ b/Documentation/admin-guide/sysctl/vm.rst
@@ -19,9 +19,6 @@ The files in this directory can be used to tune the operation
of the virtual memory (VM) subsystem of the Linux kernel and
the writeout of dirty data to disk.
-Default values and initialization routines for most of these
-files can be found in mm/swap.c.
-
Currently, these files are in /proc/sys/vm:
- admin_reserve_kbytes
diff --git a/Documentation/core-api/mm-api.rst b/Documentation/core-api/mm-api.rst
index 4df7d5edbee559..c1d03a5a2a192e 100644
--- a/Documentation/core-api/mm-api.rst
+++ b/Documentation/core-api/mm-api.rst
@@ -118,7 +118,7 @@ More Memory Management Functions
.. #kernel-doc:: mm/hmm.c (build warnings)
.. kernel-doc:: mm/memremap.c
.. kernel-doc:: mm/hugetlb.c
-.. kernel-doc:: mm/swap.c
+.. kernel-doc:: mm/folio.c
.. kernel-doc:: mm/memcontrol.c
.. #kernel-doc:: mm/memory-tiers.c (build warnings)
.. kernel-doc:: mm/shmem.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 29c302e9c17ba3..e853622a9b96ab 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17086,7 +17086,7 @@ F: Documentation/admin-guide/mm/multigen_lru.rst
F: Documentation/mm/multigen_lru.rst
F: include/linux/mm_inline.h
F: include/linux/mmzone.h
-F: mm/swap.c
+F: mm/folio.c
F: mm/vmscan.c
F: mm/workingset.c
@@ -17237,7 +17237,6 @@ F: include/linux/swap.h
F: include/linux/swapfile.h
F: include/linux/swapops.h
F: mm/page_io.c
-F: mm/swap.c
F: mm/swap.h
F: mm/swap_table.h
F: mm/swap_state.c
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 3f31b6a56788c2..696ed01709c2ba 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -287,39 +287,19 @@ static inline swp_entry_t page_swap_entry(struct page *page)
return entry;
}
-/* linux/mm/workingset.c */
-bool workingset_test_recent(void *shadow, bool file, bool *workingset,
- bool flush);
-void workingset_age_nonresident(struct lruvec *lruvec, unsigned long nr_pages);
-void *workingset_eviction(struct folio *folio, struct mem_cgroup *target_memcg);
-void workingset_refault(struct folio *folio, void *shadow);
-void workingset_activation(struct folio *folio);
-
/* linux/mm/page_alloc.c */
extern unsigned long totalreserve_pages;
/* Definition of global_zone_page_state not available yet */
#define nr_free_pages() global_zone_page_state(NR_FREE_PAGES)
+/* linux/mm/folio.c */
+void folio_add_lru(struct folio *folio);
+void folio_mark_accessed(struct folio *folio);
+void lru_add_drain_all(void);
-/* linux/mm/swap.c */
-void lru_note_cost_unlock_irq(struct lruvec *lruvec, bool file,
- unsigned int nr_io, unsigned int nr_rotated);
-void lru_note_cost_refault(struct folio *);
-void folio_add_lru(struct folio *);
-void folio_add_lru_vma(struct folio *, struct vm_area_struct *);
-void mark_page_accessed(struct page *);
-void folio_mark_accessed(struct folio *);
-
-static inline bool folio_may_be_lru_cached(struct folio *folio)
-{
- /*
- * Holding PMD-sized folios in per-CPU LRU cache unbalances accounting.
- * Holding small numbers of low-order mTHP folios in per-CPU LRU cache
- * will be sensible, but nobody has implemented and tested that yet.
- */
- return !folio_test_large(folio);
-}
+/* linux/mm/folio-compat.c */
+void mark_page_accessed(struct page *page);
extern atomic_t lru_disable_count;
@@ -328,43 +308,6 @@ static inline bool lru_cache_disabled(void)
return atomic_read(&lru_disable_count);
}
-static inline void lru_cache_enable(void)
-{
- atomic_dec(&lru_disable_count);
-}
-
-extern void lru_cache_disable(void);
-extern void lru_add_drain(void);
-extern void lru_add_drain_cpu(int cpu);
-extern void lru_add_drain_cpu_zone(struct zone *zone);
-extern void lru_add_drain_all(void);
-void folio_deactivate(struct folio *folio);
-void folio_mark_lazyfree(struct folio *folio);
-extern void swap_setup(void);
-
-/* linux/mm/vmscan.c */
-extern unsigned long zone_reclaimable_pages(struct zone *zone);
-extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
- gfp_t gfp_mask, const nodemask_t *mask);
-unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx);
-
-#define MEMCG_RECLAIM_MAY_SWAP (1 << 1)
-#define MEMCG_RECLAIM_PROACTIVE (1 << 2)
-#define MIN_SWAPPINESS 0
-#define MAX_SWAPPINESS 200
-
-/* Just reclaim from anon folios in proactive memory reclaim */
-#define SWAPPINESS_ANON_ONLY (MAX_SWAPPINESS + 1)
-
-extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
- unsigned long nr_pages,
- gfp_t gfp_mask,
- unsigned int reclaim_options,
- int *swappiness);
-extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem,
- gfp_t gfp_mask, bool noswap,
- pg_data_t *pgdat,
- unsigned long *nr_scanned);
extern unsigned long shrink_all_memory(unsigned long nr_pages);
extern int vm_swappiness;
long remove_mapping(struct address_space *mapping, struct folio *folio);
@@ -385,11 +328,6 @@ static inline void reclaim_unregister_node(struct node *node)
}
#endif /* CONFIG_SYSFS && CONFIG_NUMA */
-#ifdef CONFIG_NUMA
-extern int sysctl_min_unmapped_ratio;
-extern int sysctl_min_slab_ratio;
-#endif
-
void check_move_unevictable_folios(struct folio_batch *fbatch);
extern void __meminit kswapd_run(int nid);
@@ -545,7 +483,7 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
void lru_reparent_memcg(struct mem_cgroup *memcg, struct mem_cgroup *parent, int nid);
#else
-static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
+static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
{
return READ_ONCE(vm_swappiness);
}
diff --git a/mm/Makefile b/mm/Makefile
index 4fc713867b9bd8..8e7e964b99a478 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -50,7 +50,7 @@ endif
obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
maccess.o page-writeback.o folio-compat.o \
- readahead.o swap.o truncate.o vmscan.o shrinker.o \
+ readahead.o folio.o truncate.o vmscan.o shrinker.o \
shmem.o util.o mmzone.o vmstat.o backing-dev.o \
mm_init.o percpu.o slab_common.o \
compaction.o show_mem.o \
diff --git a/mm/swap.c b/mm/folio.c
similarity index 96%
rename from mm/swap.c
rename to mm/folio.c
index 58e4eff698cc4e..4acad3e94cbd00 100644
--- a/mm/swap.c
+++ b/mm/folio.c
@@ -1,17 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * linux/mm/swap.c
+ * linux/mm/folio.c
*
* Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
*/
/*
- * This file contains the default values for the operation of the
- * Linux VM subsystem. Fine-tuning documentation can be found in
- * Documentation/admin-guide/sysctl/vm.rst.
- * Started 18.12.91
- * Swap aging added 23.2.95, Stephen Tweedie.
- * Buffermem limits added 12.3.98, Rik van Riel.
+ * Folio LRU helpers: add/remove folios from LRU lists, batching,
+ * activation/deactivation, and page cache release paths.
*/
#include <linux/mm.h>
@@ -43,10 +39,6 @@
#define CREATE_TRACE_POINTS
#include <trace/events/pagemap.h>
-/* How many pages do we try to swap or page in/out together? As a power of 2 */
-int page_cluster;
-static const int page_cluster_max = 31;
-
struct cpu_fbatches {
/*
* The following folio batches are grouped together because they are protected
@@ -1176,35 +1168,3 @@ void lru_reparent_memcg(struct mem_cgroup *memcg, struct mem_cgroup *parent, int
lruvec_reparent_lru(child_lruvec, parent_lruvec, lru, nid);
}
#endif
-
-static const struct ctl_table swap_sysctl_table[] = {
- {
- .procname = "page-cluster",
- .data = &page_cluster,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = (void *)&page_cluster_max,
- }
-};
-
-/*
- * Perform any setup for the swap system
- */
-void __init swap_setup(void)
-{
- unsigned long megs = PAGES_TO_MB(totalram_pages());
-
- /* Use a smaller cluster for small-memory machines */
- if (megs < 16)
- page_cluster = 2;
- else
- page_cluster = 3;
- /*
- * Right now other parts of the system means that we
- * _really_ don't want to cluster much more
- */
-
- register_sysctl_init("vm", swap_sysctl_table);
-}
diff --git a/mm/internal.h b/mm/internal.h
index fa4fb69444ecdc..771bd3581fc7ac 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -31,6 +31,73 @@ struct huge_bootmem_page {
unsigned long flags;
};
+/* mm/workingset.c */
+bool workingset_test_recent(void *shadow, bool file, bool *workingset,
+ bool flush);
+void workingset_age_nonresident(struct lruvec *lruvec, unsigned long nr_pages);
+void *workingset_eviction(struct folio *folio,
+ struct mem_cgroup *target_memcg);
+void workingset_refault(struct folio *folio, void *shadow);
+void workingset_activation(struct folio *folio);
+
+/* mm/folio.c */
+void lru_note_cost_unlock_irq(struct lruvec *lruvec, bool file,
+ unsigned int nr_io, unsigned int nr_rotated);
+void lru_note_cost_refault(struct folio *folio);
+void folio_add_lru_vma(struct folio *folio, struct vm_area_struct *vma);
+
+static inline bool folio_may_be_lru_cached(struct folio *folio)
+{
+ /*
+ * Holding PMD-sized folios in per-CPU LRU cache unbalances accounting.
+ * Holding small numbers of low-order mTHP folios in per-CPU LRU cache
+ * will be sensible, but nobody has implemented and tested that yet.
+ */
+ return !folio_test_large(folio);
+}
+
+static inline void lru_cache_enable(void)
+{
+ atomic_dec(&lru_disable_count);
+}
+
+void lru_cache_disable(void);
+void lru_add_drain(void);
+void lru_add_drain_cpu(int cpu);
+void lru_add_drain_cpu_zone(struct zone *zone);
+void folio_deactivate(struct folio *folio);
+void folio_mark_lazyfree(struct folio *folio);
+
+/* mm/vmscan.c */
+unsigned long zone_reclaimable_pages(struct zone *zone);
+unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
+ gfp_t gfp_mask, const nodemask_t *mask);
+unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru,
+ int zone_idx);
+
+#define MEMCG_RECLAIM_MAY_SWAP (1 << 1)
+#define MEMCG_RECLAIM_PROACTIVE (1 << 2)
+#define MIN_SWAPPINESS 0
+#define MAX_SWAPPINESS 200
+
+/* Just reclaim from anon folios in proactive memory reclaim */
+#define SWAPPINESS_ANON_ONLY (MAX_SWAPPINESS + 1)
+
+unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
+ unsigned long nr_pages,
+ gfp_t gfp_mask,
+ unsigned int reclaim_options,
+ int *swappiness);
+unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg,
+ gfp_t gfp_mask, bool noswap,
+ pg_data_t *pgdat,
+ unsigned long *nr_scanned);
+
+#ifdef CONFIG_NUMA
+extern int sysctl_min_unmapped_ratio;
+extern int sysctl_min_slab_ratio;
+#endif
+
/*
* Maintains state across a page table move. The operation assumes both source
* and destination VMAs already exist and are specified by the user.
diff --git a/mm/memfd.c b/mm/memfd.c
index abe13b291ddc8b..6c72fe6caef75d 100644
--- a/mm/memfd.c
+++ b/mm/memfd.c
@@ -19,6 +19,7 @@
#include <linux/memfd.h>
#include <linux/pid_namespace.h>
#include <uapi/linux/memfd.h>
+#include "internal.h"
#include "swap.h"
/*
diff --git a/mm/swap.h b/mm/swap.h
index 44ab8e1e595b08..624ea8ff3d0d55 100644
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -8,8 +8,6 @@ struct mempolicy;
struct swap_iocb;
struct swap_memcg_table;
-extern int page_cluster;
-
#if defined(MAX_POSSIBLE_PHYSMEM_BITS)
#define SWAP_CACHE_PFN_BITS (MAX_POSSIBLE_PHYSMEM_BITS - PAGE_SHIFT)
#elif defined(MAX_PHYSMEM_BITS)
@@ -79,6 +77,8 @@ enum swap_cluster_flags {
};
#ifdef CONFIG_SWAP
+void swap_readahead_setup(void);
+
#include <linux/swapops.h> /* for swp_offset */
#include <linux/blk_types.h> /* for bio_end_io_t */
@@ -336,6 +336,11 @@ static inline unsigned int folio_swap_flags(struct folio *folio)
#else /* CONFIG_SWAP */
struct swap_iocb;
+
+static inline void swap_readahead_setup(void)
+{
+}
+
static inline struct swap_cluster_info *swap_cluster_lock(
struct swap_info_struct *si, pgoff_t offset, bool irq)
{
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 6fd6e3415b718b..a9f5b944172b2c 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -22,10 +22,15 @@
#include <linux/vmalloc.h>
#include <linux/huge_mm.h>
#include <linux/shmem_fs.h>
+#include <linux/sysctl.h>
#include "internal.h"
#include "swap_table.h"
#include "swap.h"
+/* Swap readahead cluster size, as a power of 2 pages. */
+static int page_cluster;
+static const int page_cluster_max = 31;
+
/*
* swapper_space is a fiction, retained to simplify the path through
* vmscan's shrink_folio_list.
@@ -985,6 +990,38 @@ struct folio *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask,
return folio;
}
+static const struct ctl_table swap_readahead_sysctl_table[] = {
+ {
+ .procname = "page-cluster",
+ .data = &page_cluster,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = (void *)&page_cluster_max,
+ }
+};
+
+/**
+ * swap_readahead_setup - defaults and sysctl for swap cache readahead clustering
+ */
+void __init swap_readahead_setup(void)
+{
+ unsigned long megs = PAGES_TO_MB(totalram_pages());
+
+ /* Use a smaller cluster for small-memory machines */
+ if (megs < 16)
+ page_cluster = 2;
+ else
+ page_cluster = 3;
+ /*
+ * Right now other parts of the system means that we
+ * _really_ don't want to cluster much more
+ */
+
+ register_sysctl_init("vm", swap_readahead_sysctl_table);
+}
+
#ifdef CONFIG_SYSFS
static ssize_t vma_ra_enabled_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f40cfe9d703b3e..ae710027d546f0 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -7646,7 +7646,7 @@ static int __init kswapd_init(void)
{
int nid;
- swap_setup();
+ swap_readahead_setup();
for_each_node_state(nid, N_MEMORY)
kswapd_run(nid);
register_sysctl_init("vm", vmscan_sysctl_table);
|
| 3/2 | 2026/07/05 14:30 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 7212 output: 101 thoughts: 743 Thoughts: **Patch Evaluation: Refactoring for Fuzzing Consideration** Okay, let's take a look at this patch series. My initial thought is to determine if this requires any fuzzing attention. I need to figure out if it introduces functional changes to the kernel that could create new attack surfaces or modify existing ones in a way that warrants fuzzing. My initial scan of the diff reveals a pattern. I see updates to documentation files (`Documentation/admin-guide/sysctl/vm.rst`, `Documentation/core-api/mm-api.rst`), a `MAINTAINERS` update, and a bit of header shuffling. Specifically, declarations are moved from `include/linux/swap.h` to `mm/internal.h`. I am also seeing a rename, from `mm/swap.c` to `mm/folio.c`, and corresponding Makefile updates. Digging deeper into the `mm/` directory changes, it appears that the `page_cluster` sysctl and its initialization (`swap_setup` is replaced by `swap_readahead_setup`) are being moved from the original `mm/swap.c` (now `mm/folio.c`) to `mm/swap_state.c`. There are some removals from `mm/folio.c`, and new additions into `mm/swap_state.c`. Based on my understanding of this patch, this looks like a straightforward refactoring. We have a rename, code reorganization, and header modifications. My intuition screams "no functional change," but let's be thorough. I'll double-check this: the `page_cluster` variables and sysctl initialization were in `mm/swap.c` and are now in `mm/swap_state.c`. The call to `swap_setup()` within `kswapd_init()` in `mm/vmscan.c` is being replaced with a call to `swap_readahead_setup()`, which, as far as I can see, does the same thing. The sysctl table itself appears unchanged. The core `mm/swap.c` file is being renamed to `mm/folio.c`, and internal declarations are moved to `mm/internal.h`. It all seems like a pure structural adjustment. Therefore, because this is a *pure* refactoring – file renaming, code movement, header reorganization – and it doesn't modify any of the kernel's execution flow or introduce any new functionality, I'm confident in concluding that it doesn't necessitate fuzzing. No worth in this case. I'm going to set `WorthFuzzing=false`. The reasoning is that this patch is a refactoring: renaming `mm/swap.c` to `mm/folio.c`, moving internal declarations, and shifting the `page-cluster` sysctl initialization. No functional changes. |
| 4/2 | 2026/07/05 14:30 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch is a pure refactoring that renames mm/swap.c to mm/folio.c, moves internal declarations from include/linux/swap.h to mm/internal.h, and moves the page-cluster sysctl initialization to mm/swap_state.c. It does not introduce any functional changes to the kernel logic.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch is a pure refactoring that renames mm/swap.c to mm/folio.c, moves internal declarations from include/linux/swap.h to mm/internal.h, and moves the page-cluster sysctl initialization to mm/swap_state.c. It does not introduce any functional changes to the kernel logic.",
"WorthFuzzing": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|