mm: init_mlocked_on_free
Subsystems (24)
PATCH 1/1 mm: init_mlocked_on_free
Adds the "PG_ofinit" page flag to specify if a page should be zeroed on free.
Implements the "init_mlocked_on_free" boot option. When this boot option is set, any mlock'ed pages are zeroed on munmap, exit or exec. If the pages are munlock'ed beforehand, no initialization will take place. This boot option is meant to combat the performance hit of "init_on_free" as reported in commit 6471384af2a6 ("mm: security: introduce init_on_alloc=1 and init_on_free=1 boot options"). With "init_mlocked_on_free", only relevant data will be freed while everything else is left untouched by the kernel.
Optimally, userspace programs will clear any key material or other confidential memory before exit and munlock the according memory regions. If a program crashes, however, userspace key managers will not be able to zero this data. If this happens, the memory will not be explicitly munlock'ed before exit either, so the kernel will zero the data and prevent data leaks. If the program finishes properly, no pages will be initialized again, as they were already munlock'ed.
In general, leaving memory mlock'ed until unmap, exit or exec can be used to specify exactly what memory should be initialized on free.
CONFIG_INIT_MLOCKED_ON_FREE_DEFAULT_ON can be set to enable "init_mlocked_on_free" by default.
--- .../admin-guide/kernel-parameters.txt | 6 +++ arch/s390/kernel/uv.c | 2 +- fs/exec.c | 2 +- include/linux/mm.h | 9 +++- include/linux/page-flags.h | 3 ++ include/linux/swap.h | 2 +- include/trace/events/mmflags.h | 3 +- mm/compaction.c | 2 +- mm/fadvise.c | 2 +- mm/gup.c | 4 +- mm/internal.h | 8 +-- mm/khugepaged.c | 6 +-- mm/madvise.c | 10 ++-- mm/memfd.c | 2 +- mm/memory.c | 6 +-- mm/migrate.c | 4 +- mm/migrate_device.c | 2 +- mm/mlock.c | 52 ++++++++++++------- mm/mm_init.c | 43 ++++++++++++--- mm/mmap.c | 4 +- mm/page_alloc.c | 3 +- mm/rmap.c | 4 +- mm/swap.c | 12 ++--- mm/swap_state.c | 6 +-- mm/vmscan.c | 8 +-- mm/zswap.c | 2 +- security/Kconfig.hardening | 14 +++++ 27 files changed, 148 insertions(+), 73 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +6 -0
@@ -2096,6 +2096,12 @@ Format: 0 | 1 Default set by CONFIG_INIT_ON_FREE_DEFAULT_ON. + init_mlocked_on_free= [MM] Fill freed userspace pages with zeroes if + they were mlock'ed and not explicitly munlock'ed + afterwards. + Format: 0 | 1 + Default set by CONFIG_INIT_MLOCKED_ON_FREE_DEFAULT_ON + init_pkru= [X86] Specify the default memory protection keys rights register contents for all processes. 0x55555554 by default (disallow access to all but pkey 0). Can
arch/s390/kernel/uv.c +1 -1
@@ -344,7 +344,7 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)* on the local CPU so that hopefully the refcount will * reach the expected safe value. */ -lru_add_drain (); +lru_add_drain (0 ); local_drain = true;/* And now we try again immediately after draining */ goto again;
fs/exec.c +1 -1
@@ -716,7 +716,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift) vma, new_start, length, false, true))return -ENOMEM ; -lru_add_drain (); +lru_add_drain (0 );tlb_gather_mmu (&tlb, mm); next =vma_next (&vmi);if (new_end > old_start) {
include/linux/mm.h +8 -1
@@ -3702,7 +3702,14 @@ DECLARE_STATIC_KEY_MAYBE(CONFIG_INIT_ON_FREE_DEFAULT_ON, init_on_free);static inline bool want_init_on_free (void ) {return static_branch_maybe (CONFIG_INIT_ON_FREE_DEFAULT_ON , - &init_on_free); + &init_on_free); +} + +DECLARE_STATIC_KEY_MAYBE (CONFIG_INIT_MLOCKED_ON_FREE_DEFAULT_ON , init_mlocked_on_free); +static inline bool want_init_mlocked_on_free (void ) +{ +return static_branch_maybe (CONFIG_INIT_MLOCKED_ON_FREE_DEFAULT_ON , + &init_mlocked_on_free); }extern bool _debug_pagealloc_enabled_early;
include/linux/page-flags.h +3 -0
@@ -119,6 +119,7 @@ enum pageflags { PG_reclaim,/* To be reclaimed asap */ PG_swapbacked,/* Page is backed by RAM/swap */ PG_unevictable,/* Page is "unevictable" */ + PG_ofinit,/* Page should be initialized on free */ #ifdef CONFIG_MMU PG_mlocked, /* Page is vma mlocked */ #endif
@@ -562,6 +563,8 @@ PAGEFLAG_FALSE(Mlocked, mlocked) __CLEARPAGEFLAG_NOOP(Mlocked, mlocked) TESTSCFLAG_FALSE(Mlocked, mlocked)#endif +PAGEFLAG(Ofinit, ofinit, PF_NO_TAIL) +#ifdef CONFIG_ARCH_USES_PG_UNCACHED PAGEFLAG (Uncached, uncached,PF_NO_COMPOUND ) #else
include/linux/swap.h +1 -1
@@ -389,7 +389,7 @@ static inline void lru_cache_enable(void) }extern void lru_cache_disable (void ); -extern void lru_add_drain (void ); +extern void lru_add_drain (int cofinit);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 );
include/trace/events/mmflags.h +2 -1
@@ -118,7 +118,8 @@DEF_PAGEFLAG_NAME (mappedtodisk), \DEF_PAGEFLAG_NAME (reclaim ), \DEF_PAGEFLAG_NAME (swapbacked ), \ - DEF_PAGEFLAG_NAME(unevictable) \ + DEF_PAGEFLAG_NAME(unevictable), \ + DEF_PAGEFLAG_NAME(ofinit) \ IF_HAVE_PG_MLOCK(mlocked) \ IF_HAVE_PG_UNCACHED(uncached) \ IF_HAVE_PG_HWPOISON(hwpoison) \
mm/compaction.c +1 -1
@@ -2503,7 +2503,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)trace_mm_compaction_begin (cc, start_pfn, end_pfn, sync);/* lru_add_drain_all could be expensive with involving other CPUs */ -lru_add_drain (); +lru_add_drain (0 );while ((ret =compact_finished (cc)) ==COMPACT_CONTINUE ) {int err;
mm/fadvise.c +1 -1
@@ -153,7 +153,7 @@ int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)* second cache tree walk below by flushing * them out right away. */ -lru_add_drain (); +lru_add_drain (0 );mapping_try_invalidate (mapping, start_index, end_index, &nr_failed);
mm/gup.c +2 -2
@@ -1676,7 +1676,7 @@ long populate_vma_page_range(struct vm_area_struct *vma,*/ ret =__get_user_pages (mm, start, nr_pages, gup_flags,NULL , locked ? locked : &local_locked); -lru_add_drain (); +lru_add_drain (0 );return ret; }
@@ -1734,7 +1734,7 @@ long faultin_vma_page_range(struct vm_area_struct *vma, unsigned long start, ret =__get_user_pages (mm, start, nr_pages, gup_flags,NULL , locked); -lru_add_drain (); +lru_add_drain (0 );return ret; }
mm/internal.h +4 -4
@@ -670,7 +670,7 @@ static inline void mlock_vma_folio(struct folio *folio,mlock_folio (folio); } -void munlock_folio (struct folio *folio); +void munlock_folio (struct folio *folio,int cofinit);static inline void munlock_vma_folio (struct folio *folio,struct vm_area_struct *vma) {
@@ -684,12 +684,12 @@ static inline void munlock_vma_folio(struct folio *folio,* if it's wrong. */ if (unlikely (vma->vm_flags &VM_LOCKED )) -munlock_folio (folio); +munlock_folio (folio,0 ); }void mlock_new_folio (struct folio *folio);bool need_mlock_drain (int cpu); -void mlock_drain_local (void ); +void mlock_drain_local (int cofinit);void mlock_drain_remote (int cpu);extern pmd_t maybe_pmd_mkwrite (pmd_t pmd,struct vm_area_struct *vma);
@@ -777,7 +777,7 @@ static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf,static inline void unmap_mapping_folio (struct folio *folio) { }static inline void mlock_new_folio (struct folio *folio) { }static inline bool need_mlock_drain (int cpu) {return false; } -static inline void mlock_drain_local (void ) { } +static inline void mlock_drain_local (int cofinit) { }static inline void mlock_drain_remote (int cpu) { }static inline void vunmap_range_noflush (unsigned long start,unsigned long end) {
mm/khugepaged.c +3 -3
@@ -1048,7 +1048,7 @@ static int __collapse_huge_page_swapin(struct mm_struct *mm,/* Drain LRU cache to remove extra pin on the swapped in pages */ if (swapped_in) -lru_add_drain (); +lru_add_drain (0 ); result =SCAN_SUCCEED ; out:
@@ -1863,7 +1863,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, goto xa_unlocked; }/* drain lru cache to help isolate_lru_page() */ -lru_add_drain (); +lru_add_drain (0 ); page =folio_file_page (folio, index); }else if (trylock_page (page)) {get_page (page);
@@ -1879,7 +1879,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, file, index, end - index);/* drain lru cache to help isolate_lru_page() */ -lru_add_drain (); +lru_add_drain (0 ); page =find_lock_page (mapping, index);if (unlikely (page ==NULL )) { result =SCAN_FAIL ;
mm/madvise.c +5 -5
@@ -270,13 +270,13 @@ static long madvise_willneed(struct vm_area_struct *vma,#ifdef CONFIG_SWAP if (!file) {walk_page_range (vma->vm_mm, start, end, &swapin_walk_ops, vma); -lru_add_drain ();/* Push any new pages onto the LRU now */ +lru_add_drain (0 );/* Push any new pages onto the LRU now */ return 0 ; }if (shmem_mapping (file->f_mapping)) {shmem_swapin_range (vma, start, end, file->f_mapping); -lru_add_drain ();/* Push any new pages onto the LRU now */ +lru_add_drain (0 );/* Push any new pages onto the LRU now */ return 0 ; }#else
@@ -564,7 +564,7 @@ static long madvise_cold(struct vm_area_struct *vma,if (!can_madv_lru_vma (vma))return -EINVAL ; -lru_add_drain (); +lru_add_drain (0 );tlb_gather_mmu (&tlb, mm);madvise_cold_page_range (&tlb, vma, start_addr, end_addr);tlb_finish_mmu (&tlb);
@@ -607,7 +607,7 @@ static long madvise_pageout(struct vm_area_struct *vma, (vma->vm_flags & VM_MAYSHARE)))return 0 ; -lru_add_drain (); +lru_add_drain (0 );tlb_gather_mmu (&tlb, mm);madvise_pageout_page_range (&tlb, vma, start_addr, end_addr);tlb_finish_mmu (&tlb);
@@ -775,7 +775,7 @@ static int madvise_free_single_vma(struct vm_area_struct *vma,mmu_notifier_range_init (&range,MMU_NOTIFY_CLEAR ,0 , mm, range.start, range.end); -lru_add_drain (); +lru_add_drain (0 );tlb_gather_mmu (&tlb, mm);update_hiwater_rss (mm);
mm/memfd.c +1 -1
@@ -35,7 +35,7 @@ static void memfd_tag_pins(struct xa_state *xas)int latency =0 ;int cache_count; -lru_add_drain (); +lru_add_drain (0 );xas_lock_irq (xas);xas_for_each (xas, page,ULONG_MAX ) {
mm/memory.c +3 -3
@@ -1769,7 +1769,7 @@ void zap_page_range_single(struct vm_area_struct *vma, unsigned long address,struct mmu_notifier_range range;struct mmu_gather tlb; -lru_add_drain (); +lru_add_drain (0 );mmu_notifier_range_init (&range,MMU_NOTIFY_CLEAR ,0 , vma->vm_mm, address, end);hugetlb_zap_begin (vma, &range.start, &range.end);
@@ -3382,7 +3382,7 @@ static bool wp_can_reuse_anon_folio(struct folio *folio,* We cannot easily detect+handle references from * remote LRU caches or references to LRU folios. */ -lru_add_drain (); +lru_add_drain (0 );if (folio_ref_count (folio) >1 +folio_test_swapcache (folio))return false;if (!folio_trylock (folio))
@@ -3960,7 +3960,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)*/ if ((vmf->flags &FAULT_FLAG_WRITE ) && folio == swapcache && !folio_test_ksm (folio) && !folio_test_lru (folio)) -lru_add_drain (); +lru_add_drain (0 ); }folio_throttle_swaprate (folio,GFP_KERNEL );
mm/migrate.c +2 -2
@@ -266,7 +266,7 @@ static bool remove_migration_pte(struct folio *folio,set_pte_at (vma->vm_mm, pvmw.address, pvmw.pte, pte); }if (vma->vm_flags &VM_LOCKED ) -mlock_drain_local (); +mlock_drain_local (0 );trace_remove_migration_pte (pvmw.address,pte_val (pte),compound_order (new));
@@ -1299,7 +1299,7 @@ static int migrate_folio_move(free_folio_t put_new_folio, unsigned long private,*/ folio_add_lru (dst);if (old_page_state &PAGE_WAS_MLOCKED ) -lru_add_drain (); +lru_add_drain (0 );if (old_page_state &PAGE_WAS_MAPPED )remove_migration_ptes (src, dst, false);
mm/migrate_device.c +1 -1
@@ -362,7 +362,7 @@ static unsigned long migrate_device_unmap(unsigned long *src_pfns,bool allow_drain = true;unsigned long unmapped =0 ; -lru_add_drain (); +lru_add_drain (0 );for (i =0 ; i < npages; i++) {struct page *page =migrate_pfn_to_page (src_pfns[i]);
mm/mlock.c +32 -20
183 lines not on this page · raw message
mm/mm_init.c +37 -6
79 lines not on this page · raw message
mm/mmap.c +2 -2
@@ -2295,7 +2295,7 @@ static void unmap_region(struct mm_struct *mm, struct ma_state *mas,struct mmu_gather tlb;unsigned long mt_start = mas->index; -lru_add_drain (); +lru_add_drain (0 );tlb_gather_mmu (&tlb, mm);update_hiwater_rss (mm);unmap_vmas (&tlb, mas, vma, start, end, tree_end, mm_wr_locked);
@@ -3266,7 +3266,7 @@ void exit_mmap(struct mm_struct *mm) goto destroy; } -lru_add_drain (); +lru_add_drain (0 );flush_cache_mm (mm);tlb_gather_mmu_fullmm (&tlb, mm);/* update_hiwater_rss(mm) here? but nobody should be looking */
mm/page_alloc.c +2 -1
@@ -17,6 +17,7 @@#include <linux/stddef.h> #include <linux/mm.h> +#include <linux/page-flags.h> #include <linux/highmem.h> #include <linux/interrupt.h> #include <linux/jiffies.h>
@@ -1078,7 +1079,7 @@ static __always_inline bool free_pages_prepare(struct page *page, {int bad =0 ;bool skip_kasan_poison =should_skip_kasan_poison (page, fpi_flags); -bool init =want_init_on_free (); +bool init =want_init_on_free () ||PageOfinit (page);bool compound =PageCompound (page);VM_BUG_ON_PAGE (PageTail (page), page);
mm/rmap.c +2 -2
@@ -1836,7 +1836,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, discard:page_remove_rmap (subpage, vma,folio_test_hugetlb (folio));if (vma->vm_flags &VM_LOCKED ) -mlock_drain_local (); +mlock_drain_local (0 );folio_put (folio); }
@@ -2189,7 +2189,7 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma,page_remove_rmap (subpage, vma,folio_test_hugetlb (folio));if (vma->vm_flags &VM_LOCKED ) -mlock_drain_local (); +mlock_drain_local (0 );folio_put (folio); }
mm/swap.c +6 -6
@@ -746,12 +746,12 @@ void folio_mark_lazyfree(struct folio *folio) } } -void lru_add_drain (void ) +void lru_add_drain (int cofinit) {local_lock (&cpu_fbatches.lock);lru_add_drain_cpu (smp_processor_id ());local_unlock (&cpu_fbatches.lock); -mlock_drain_local (); +mlock_drain_local (cofinit); }/*
@@ -766,7 +766,7 @@ static void lru_add_and_bh_lrus_drain(void)lru_add_drain_cpu (smp_processor_id ());local_unlock (&cpu_fbatches.lock);invalidate_bh_lrus_cpu (); -mlock_drain_local (); +mlock_drain_local (0 ); }void lru_add_drain_cpu_zone (struct zone *zone)
@@ -775,7 +775,7 @@ void lru_add_drain_cpu_zone(struct zone *zone)lru_add_drain_cpu (smp_processor_id ());drain_local_pages (zone);local_unlock (&cpu_fbatches.lock); -mlock_drain_local (); +mlock_drain_local (0 ); }#ifdef CONFIG_SMP
@@ -907,7 +907,7 @@ void lru_add_drain_all(void)#else void lru_add_drain_all (void ) { -lru_add_drain (); +lru_add_drain (0 ); }#endif /* CONFIG_SMP */
@@ -1056,7 +1056,7 @@ EXPORT_SYMBOL(release_pages);void __folio_batch_release (struct folio_batch *fbatch) {if (!fbatch->percpu_pvec_drained) { -lru_add_drain (); +lru_add_drain (0 ); fbatch->percpu_pvec_drained = true; }release_pages (fbatch->folios,folio_batch_count (fbatch));
mm/swap_state.c +3 -3
@@ -310,7 +310,7 @@ void free_page_and_swap_cache(struct page *page)*/ void free_pages_and_swap_cache (struct encoded_page **pages,int nr) { -lru_add_drain (); +lru_add_drain (0 );for (int i =0 ; i < nr; i++)free_swap_cache (encoded_page_ptr (pages[i]));release_pages (pages, nr);
@@ -668,7 +668,7 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, }blk_finish_plug (&plug);swap_read_unplug (splug); -lru_add_drain ();/* Push any new pages onto the LRU now */ +lru_add_drain (0 );/* Push any new pages onto the LRU now */ skip:/* The page was likely read above, so no need for plugging here */ page = __read_swap_cache_async(entry, gfp_mask, mpol, ilx,
@@ -843,7 +843,7 @@ static struct page *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask,pte_unmap (pte);blk_finish_plug (&plug);swap_read_unplug (splug); -lru_add_drain (); +lru_add_drain (0 ); skip:/* The page was likely read above, so no need for plugging here */ page = __read_swap_cache_async(targ_entry, gfp_mask, mpol, targ_ilx,
mm/vmscan.c +4 -4
@@ -1919,7 +1919,7 @@ static unsigned long shrink_inactive_list(unsigned long nr_to_scan,return SWAP_CLUSTER_MAX ; } -lru_add_drain (); +lru_add_drain (0 );spin_lock_irq (&lruvec->lru_lock);
@@ -2028,7 +2028,7 @@ static void shrink_active_list(unsigned long nr_to_scan,int file =is_file_lru (lru);struct pglist_data *pgdat =lruvec_pgdat (lruvec); -lru_add_drain (); +lru_add_drain (0 );spin_lock_irq (&lruvec->lru_lock);
@@ -4836,7 +4836,7 @@ static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct scan_control *scVM_WARN_ON_ONCE (root_reclaim (sc));VM_WARN_ON_ONCE (!sc->may_writepage || !sc->may_unmap); -lru_add_drain (); +lru_add_drain (0 );blk_start_plug (&plug);
@@ -4904,7 +4904,7 @@ static void lru_gen_shrink_node(struct pglist_data *pgdat, struct scan_control *if (!sc->may_writepage || !sc->may_unmap) goto done; -lru_add_drain (); +lru_add_drain (0 );blk_start_plug (&plug);
mm/zswap.c +1 -1
@@ -1146,7 +1146,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry,if (!PageLRU (page)) {/* drain lru cache to help folio_rotate_reclaimable() */ -lru_add_drain (); +lru_add_drain (0 ); }/* start writeback */
security/Kconfig.hardening +14 -0
@@ -255,6 +255,20 @@ config INIT_ON_FREE_DEFAULT_ON touching "cold" memory areas. Most cases see 3-5% impact. Some synthetic workloads have measured as high as 8%. +config INIT_MLOCKED_ON_FREE_DEFAULT_ON + bool "Enable mlocked memory zeroing on free" + depends on !KMSAN + help + This config has the effect of setting "init_mlocked_on_free=1" + on the kernel command line. This can be disabled with + "init_mlocked_on_free=0". When "init_mlocked_on_free" is enabled, + all mlocked process memory will be zeroed when freed. This + restriction to mlocked memory improves performance over + "init_on_free" but can still be used to protect confidential + data like key material from content exposures to other processes, + as well as live forensics and cold boot attacks. Any non-mlocked + memory will not be cleared before it is reassigned. + config CC_HAS_ZERO_CALL_USED_REGS def_bool $(cc-option,-fzero-call-used-regs=used-gpr) # https://github.com/ClangBuiltLinux/linux/issues/1766
base-commit: 4e87148f80d198ba5febcbcc969c6b9471099a09
Signature · 1 line
2.34.1
Andrew Morton
maintainerQuoted 2 lines · On Sat, 2 Dec 2023 14:42:18 +0100 York Jasper Niebuhr…
Adds the "
PG_ofinit" page flag to specify if a page should be zeroed on free.
That's a problem - unused page flags are few, and are a treasured resource. Matthew Wilcox is a suitable reviewer, but you didn't cc the linux-mm mailing list.
Please address this concern in future changelogs.
Quoted 8 lines
Implements the "
init_mlocked_on_free" boot option. When this boot option is set, any mlock'ed pages are zeroed on munmap, exit or exec. If the pages are munlock'ed beforehand, no initialization will take place. This boot option is meant to combat the performance hit of "init_on_free" as reported in commit6471384af2a6("mm: security: introduce init_on_alloc=1 and init_on_free=1 boot options"). With "init_mlocked_on_free", only relevant data will be freed while everything else is left untouched by the kernel.
It would be helpful to provide a full description of the performance benefits right here in the changelog, please. Including example quantitative testing results. See if you can persuade us to consume another page flag.
Also, can we avoid using a page flag? Can this be done on a per-vma
basis rather than per-page?
Quoted 8 lines
Optimally, userspace programs will clear any key material or other confidential memory before exit and munlock the according memory regions. If a program crashes, however, userspace key managers will not be able to zero this data. If this happens, the memory will not be explicitly munlock'ed before exit either, so the kernel will zero the data and prevent data leaks. If the program finishes properly, no pages will be initialized again, as they were already munlock'ed.
Quoted 6 lines
In general, leaving memory mlock'ed until unmap, exit or exec can be used to specify exactly what memory should be initialized on free.
CONFIG_INIT_MLOCKED_ON_FREE_DEFAULT_ONcan be set to enable "init_mlocked_on_free" by default.
Please address the above and send us a v2?
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi York,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 4e87148f80d198ba5febcbcc969c6b9471099a09]
url: https://github.com/intel-lab-lkp/linux/commits/York-Jasper-Niebuhr/mm-init_mlocked_on_free/20231202-214431 base: 4e87148f80d198ba5febcbcc969c6b9471099a09 patch link: https://lore.kernel.org/r/20231202134218.151074-1-yjnworkstation%40gmail.com patch subject: [PATCH] mm: init_mlocked_on_free config: i386-randconfig-141-20231203 (https://download.01.org/0day-ci/archive/20231206/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231206/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> mm/mlock.c:301: warning: Function parameter or member 'cofinit' not described in 'munlock_folio'
vim +301 mm/mlock.c
7225522bb429a2f Vlastimil Babka 2013-09-11 295
2fbb0c10d1e8222 Hugh Dickins 2022-02-14 296 /**
96f97c438f61ddb Lorenzo Stoakes 2023-01-12 297 * munlock_folio - munlock a folio
96f97c438f61ddb Lorenzo Stoakes 2023-01-12 298 * @folio: folio to be munlocked, either normal or a THP head.
5b40998ae35cf64 Vlastimil Babka 2013-09-11 299 */
9cdd4fc5d036cbe York Jasper Niebuhr 2023-12-02 300 void munlock_folio(struct folio *folio, int cofinit)
2fbb0c10d1e8222 Hugh Dickins 2022-02-14 @301 {
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 302 struct folio_batch *fbatch;
56afe477df3cbbc Vlastimil Babka 2013-09-11 303
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 304 local_lock(&mlock_fbatch.lock);
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 305 fbatch = this_cpu_ptr(&mlock_fbatch.fbatch);
5b40998ae35cf64 Vlastimil Babka 2013-09-11 306 /*
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 307 * folio_test_clear_mlocked(folio) must be left to __munlock_folio(),
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 308 * which will check whether the folio is multiply mlocked.
5b40998ae35cf64 Vlastimil Babka 2013-09-11 309 */
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 310 folio_get(folio);
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 311 if (!folio_batch_add(fbatch, folio) ||
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 312 folio_test_large(folio) || lru_cache_disabled())
9cdd4fc5d036cbe York Jasper Niebuhr 2023-12-02 313 mlock_folio_batch(fbatch, cofinit);
90d07210ab55e45 Lorenzo Stoakes 2023-01-12 314 local_unlock(&mlock_fbatch.lock);
7a8010cd36273ff Vlastimil Babka 2013-09-11 315 }
56afe477df3cbbc Vlastimil Babka 2013-09-11 316 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki