Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795542954; b=wW8PH8qYw4yYB6gYtiH7ATdwfjdm+b0S+zFU9x7YWQzUlQPJLCMwsrSNR0BmmlOjFpYJ WIcyTb3audIiJ5smiaSs5aDWmHK8Q92SZJ0+RCfgphVyNYyxD6YfV6sTsBG89VpqyurHO hPVymQ+nashZ1bw8ubgsYSGLOCaKDBugu4sSN8TYrA3bDqHOUW+g4xBNs9qA9OZDLmLO2 VFy1r+tBOGdcJGc0rdVMy8CWAJHi9dg47ddSUFNu0pw065EtxCRUQgJyJ95k59tyImXZz zOZEcy3R6XF6f4LjGIiT0ifCTWhyiXjw3gn5AoFD4IeBcGPIhIfcJ4cUP+0aug0SozQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795542954; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=EXHPBo1j6echpyYMtS5HYF6q15GcWM6Q7UZm30+gM4g=; b=BXA0GGqdj8580/j35AWwybBZoROrxecDGIIVImPQ6eKzW8LoSjVyk+YxC7SPCpf9JBBz WtcMIj8tOiSaWV7RYIJDFj0roR05d0EiCH6FYb2/RuwVO0z9wXJITEL0u+Nx+0WH6/N5a 7hUE30b8UPMdnXe7hW23odfUkmNhyg6zzGLfvYvSiLPIJIOemhCDWfXZ/rav682WT3uxc UMRjeuz3tMBWJ8Kd+ZwsxNr79gT2s3sMAUATU2+0ucfelROdt1yRMio1XCbUYbFtg4Aiy 3vnxLwIxKce4Gk9hURA1rdtaUW5EVte4BaVPr5myLU+gFmEaI6SJKqLvLswINapOGIg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=T1bhEMMk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66AF4606A31E for ; Tue, 24 Nov 2026 17:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=T1bhEMMk Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB2181F000CF; Tue, 24 Nov 2026 17:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1795542953; bh=EXHPBo1j6echpyYMtS5HYF6q15GcWM6Q7UZm30+gM4g=; h=Date:To:From:In-Reply-To:References:Subject; b=T1bhEMMk6fX/GOZZdpkyy0EL/mvdnMwUA1r2KdV8d456f17U02BHm9jwUM2lPk2kg f/jUNfePXZhy2RJj2nQyE7WKrkPG7qtna0cgFnNvp2iGhhoQvxSqVOpEzvvSGDXZz/ cLT/4LS5ald8+TEzLfHlQoZlnD6CEF3NOKD7VHtU= Date: Tue, 24 Nov 2026 09:55:53 -0800 To: mm-commits@vger.kernel.org,ljs@kernel.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261124-late-2026-vma-flags-v2-1-bf3fade93064@kernel.org> References: <20261124-late-2026-vma-flags-v2-1-bf3fade93064@kernel.org> Subject: + mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch added to mm-new branch Message-Id: <20261124175553.CB2181F000CF@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/filemap: convert fault and readahead logic to use vma_flags_t has been added to the -mm mm-new branch. Its filename is mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: "Lorenzo Stoakes (ARM)" Subject: mm/filemap: convert fault and readahead logic to use vma_flags_t Date: Tue, 24 Nov 2026 17:07:53 +0000 Patch series "mm: continue vma_flags_t conversion", v2. Continue the conversion of legacy vm_flags_t flags to the new vma_flags_t bitmap type. Do some more core mm conversion (we really should be the first to completely move to the new scheme :), but also update some mm-adjacent and otherwise straightforward cases - /proc/$pid/maps and friends, the coredump VMA dump size logic, uprobes, perf and LSM mmap/mprotect hooks. This series only makes strictly mechanical changes to keep things gentle during this very busy cycle. No functional change intended. This patch (of 11): Replace use of the legacy vm_flags_t flags with vma_flags_t values in the file fault and mmap readahead logic. No functional change intended. Link: https://lore.kernel.org/20261124-late-2026-vma-flags-v2-0-bf3fade93064@kernel.org Link: https://patch.msgid.link/20261124-late-2026-vma-flags-v2-1-bf3fade93064@kernel.org Signed-off-by: Lorenzo Stoakes (ARM) Signed-off-by: Andrew Morton Reviewed-by: Barry Song Reviewed-by: Jan Kara Cc: David Hildenbrand Cc: Jason Gunthorpe Cc: John Hubbard Cc: Peter Xu Cc: Matthew Wilcox (Oracle) Cc: Rik van Riel Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Harry Yoo Cc: Jann Horn Cc: Lance Yang Cc: Zi Yan Cc: Matthew Brost Cc: Joshua Hahn Cc: Byungchul Park Cc: Gregory Price Cc: Ying Huang Cc: Alistair Popple Cc: Baolin Wang Cc: Nico Pache Cc: Ryan Roberts Cc: Dev Jain Cc: Usama Arif Cc: Kiryl Shutsemau Cc: Xu Xin Cc: Chengming Zhou Cc: Madhavan Srinivasan Cc: Nicholas Piggin Cc: Michael Ellerman Cc: Christophe Leroy Cc: Ritesh Harjani (IBM) Cc: Shrikanth Hegde Cc: Pedro Falcato Cc: Kairui Song Cc: Qi Zheng Cc: Shakeel Butt Cc: Axel Rasmussen Cc: Yuanchu Xie Cc: Wei Xu Cc: Baoquan He Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Leon Romanovsky Cc: SJ Park Cc: Rakie Kim Cc: David Rientjes Cc: Al Viro Cc: Christian Brauner Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Namhyung Kim Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Ian Rogers Cc: Adrian Hunter Cc: James Clark Cc: Masami Hiramatsu Cc: Oleg Nesterov Cc: John Johansen Cc: Georgia Garcia Cc: Paul Moore Cc: James Morris Cc: Serge E. Hallyn Cc: Mimi Zohar Cc: Roberto Sassu Cc: Dmitry Kasatkin Cc: Eric Snowberg Cc: Fan Wu Cc: Stephen Smalley Cc: Ondrej Mosnáček mm/filemap.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) --- a/mm/filemap.c~mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t +++ a/mm/filemap.c @@ -3359,13 +3359,14 @@ static struct file *do_sync_mmap_readahe struct address_space *mapping = file->f_mapping; DEFINE_READAHEAD(ractl, file, ra, mapping, vmf->pgoff); struct file *fpin = NULL; - vm_flags_t vm_flags = vmf->vma->vm_flags; + struct vm_area_struct *vma = vmf->vma; bool force_thp_readahead = false; unsigned int thp_order = 0; unsigned short mmap_miss; /* Use the readahead code, even if readahead is disabled */ - if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && (vm_flags & VM_HUGEPAGE)) { + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && + vma_test(vma, VMA_HUGEPAGE_BIT)) { /* * Cap max THP order at 2MB: this is the common PMD-sized * hugepage size, and it avoids memory pressure from very @@ -3385,20 +3386,21 @@ static struct file *do_sync_mmap_readahe * If we don't want any read-ahead, don't bother. * VM_EXEC case below is already intended for random access. */ - if ((vm_flags & (VM_RAND_READ | VM_EXEC)) == VM_RAND_READ) + if (vma_test(vma, VMA_RAND_READ_BIT) && + !vma_test(vma, VMA_EXEC_BIT)) return fpin; if (!ra->ra_pages) return fpin; - if (vm_flags & VM_SEQ_READ) { + if (vma_test(vma, VMA_SEQ_READ_BIT)) { fpin = maybe_unlock_mmap_for_io(vmf, fpin); page_cache_sync_ra(&ractl, ra->ra_pages); return fpin; } } - if (!(vm_flags & (VM_SEQ_READ | VM_EXEC))) { + if (!vma_test_any(vma, VMA_SEQ_READ_BIT, VMA_EXEC_BIT)) { /* Avoid banging the cache line if not needed */ mmap_miss = READ_ONCE(ra->mmap_miss); if (mmap_miss < MMAP_LOTSAMISS * 10) @@ -3414,6 +3416,7 @@ static struct file *do_sync_mmap_readahe if (force_thp_readahead) { unsigned long folio_nr_pages = 1UL << thp_order; + const bool random_read = vma_test(vma, VMA_RAND_READ_BIT); fpin = maybe_unlock_mmap_for_io(vmf, fpin); ractl._index &= ~(folio_nr_pages - 1); @@ -3422,7 +3425,7 @@ static struct file *do_sync_mmap_readahe * Fetch two folios so we get the chance to actually * readahead, unless we've been told not to. */ - if (!(vm_flags & VM_RAND_READ)) + if (!random_read) ra->size *= 2; ra->async_size = folio_nr_pages; ra->order = thp_order; @@ -3430,7 +3433,7 @@ static struct file *do_sync_mmap_readahe return fpin; } - if (vm_flags & VM_EXEC) { + if (vma_test(vma, VMA_EXEC_BIT)) { /* * Allow arch to request a preferred minimum folio order for * executable memory. This can often be beneficial to @@ -3442,7 +3445,6 @@ static struct file *do_sync_mmap_readahe * pad that might exist between sections, which would be a waste * of memory. */ - struct vm_area_struct *vma = vmf->vma; const unsigned long start = vma_start_pgoff(vma); const unsigned long end = vma_end_pgoff(vma); unsigned long ra_end; @@ -3485,7 +3487,7 @@ static struct file *do_async_mmap_readah unsigned short mmap_miss; /* If we don't want any read-ahead, don't bother */ - if (vmf->vma->vm_flags & VM_RAND_READ || !ra->ra_pages) + if (vma_test(vmf->vma, VMA_RAND_READ_BIT) || !ra->ra_pages) return fpin; /* @@ -3499,7 +3501,7 @@ static struct file *do_async_mmap_readah * keep the counter symmetric. */ if (likely(!folio_test_locked(folio)) && - !(vmf->vma->vm_flags & (VM_SEQ_READ | VM_EXEC))) { + !vma_test_any(vmf->vma, VMA_SEQ_READ_BIT, VMA_EXEC_BIT)) { mmap_miss = READ_ONCE(ra->mmap_miss); if (mmap_miss) WRITE_ONCE(ra->mmap_miss, --mmap_miss); @@ -3532,7 +3534,7 @@ static vm_fault_t filemap_fault_recheck_ * scenarios. Recheck the PTE without PT lock firstly, thereby reducing * the number of times we hold PT lock. */ - if (!(vma->vm_flags & VM_LOCKED)) + if (!vma_test(vma, VMA_LOCKED_BIT)) return 0; if (!(vmf->flags & FAULT_FLAG_ORIG_PTE_VALID)) @@ -4018,7 +4020,7 @@ vm_fault_t filemap_map_pages(struct vm_f if ((map_ret & VM_FAULT_NOPAGE) && !(vmf->flags & FAULT_FLAG_TRIED) && !folio_test_workingset(folio) && - !(vma->vm_flags & (VM_SEQ_READ | VM_EXEC))) { + !vma_test_any(vma, VMA_SEQ_READ_BIT, VMA_EXEC_BIT)) { unsigned short mmap_miss; mmap_miss = READ_ONCE(file->f_ra.mmap_miss); _ Patches currently in -mm which might be from ljs@kernel.org are mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch