Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/memory-failure: pass the folio to collect_procs_ksm()

We've already calculated it, so pass it in instead of recalculating it in
collect_procs_ksm().

Link: https://lkml.kernel.org/r/20240412193510.2356957-12-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Jane Chu <jane.chu@oracle.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
b650e1d2 0edb5b28

+6 -15
+3 -11
include/linux/ksm.h
··· 81 81 82 82 void rmap_walk_ksm(struct folio *folio, struct rmap_walk_control *rwc); 83 83 void folio_migrate_ksm(struct folio *newfolio, struct folio *folio); 84 - 85 - #ifdef CONFIG_MEMORY_FAILURE 86 - void collect_procs_ksm(struct page *page, struct list_head *to_kill, 87 - int force_early); 88 - #endif 89 - 90 - #ifdef CONFIG_PROC_FS 84 + void collect_procs_ksm(struct folio *folio, struct page *page, 85 + struct list_head *to_kill, int force_early); 91 86 long ksm_process_profit(struct mm_struct *); 92 - #endif /* CONFIG_PROC_FS */ 93 87 94 88 #else /* !CONFIG_KSM */ 95 89 ··· 114 120 { 115 121 } 116 122 117 - #ifdef CONFIG_MEMORY_FAILURE 118 - static inline void collect_procs_ksm(struct page *page, 123 + static inline void collect_procs_ksm(struct folio *folio, struct page *page, 119 124 struct list_head *to_kill, int force_early) 120 125 { 121 126 } 122 - #endif 123 127 124 128 #ifdef CONFIG_MMU 125 129 static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
+2 -3
mm/ksm.c
··· 3178 3178 /* 3179 3179 * Collect processes when the error hit an ksm page. 3180 3180 */ 3181 - void collect_procs_ksm(struct page *page, struct list_head *to_kill, 3182 - int force_early) 3181 + void collect_procs_ksm(struct folio *folio, struct page *page, 3182 + struct list_head *to_kill, int force_early) 3183 3183 { 3184 3184 struct ksm_stable_node *stable_node; 3185 3185 struct ksm_rmap_item *rmap_item; 3186 - struct folio *folio = page_folio(page); 3187 3186 struct vm_area_struct *vma; 3188 3187 struct task_struct *tsk; 3189 3188
+1 -1
mm/memory-failure.c
··· 729 729 if (!folio->mapping) 730 730 return; 731 731 if (unlikely(folio_test_ksm(folio))) 732 - collect_procs_ksm(page, tokill, force_early); 732 + collect_procs_ksm(folio, page, tokill, force_early); 733 733 else if (folio_test_anon(folio)) 734 734 collect_procs_anon(folio, page, tokill, force_early); 735 735 else