linux/mm
Muhammad Usama Anjum 52526ca7fd fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs
The PAGEMAP_SCAN IOCTL on the pagemap file can be used to get or optionally
clear the info about page table entries. The following operations are
supported in this IOCTL:
- Scan the address range and get the memory ranges matching the provided
  criteria. This is performed when the output buffer is specified.
- Write-protect the pages. The PM_SCAN_WP_MATCHING is used to write-protect
  the pages of interest. The PM_SCAN_CHECK_WPASYNC aborts the operation if
  non-Async Write Protected pages are found. The ``PM_SCAN_WP_MATCHING``
  can be used with or without PM_SCAN_CHECK_WPASYNC.
- Both of those operations can be combined into one atomic operation where
  we can get and write protect the pages as well.

Following flags about pages are currently supported:
- PAGE_IS_WPALLOWED - Page has async-write-protection enabled
- PAGE_IS_WRITTEN - Page has been written to from the time it was write protected
- PAGE_IS_FILE - Page is file backed
- PAGE_IS_PRESENT - Page is present in the memory
- PAGE_IS_SWAPPED - Page is in swapped
- PAGE_IS_PFNZERO - Page has zero PFN
- PAGE_IS_HUGE - Page is THP or Hugetlb backed

This IOCTL can be extended to get information about more PTE bits. The
entire address range passed by user [start, end) is scanned until either
the user provided buffer is full or max_pages have been found.

[akpm@linux-foundation.org: update it for "mm: hugetlb: add huge page size param to set_huge_pte_at()"]
[akpm@linux-foundation.org: fix CONFIG_HUGETLB_PAGE=n warning]
[arnd@arndb.de: hide unused pagemap_scan_backout_range() function]
  Link: https://lkml.kernel.org/r/20230927060257.2975412-1-arnd@kernel.org
[sfr@canb.auug.org.au: fix "fs/proc/task_mmu: hide unused pagemap_scan_backout_range() function"]
  Link: https://lkml.kernel.org/r/20230928092223.0625c6bf@canb.auug.org.au
Link: https://lkml.kernel.org/r/20230821141518.870589-3-usama.anjum@collabora.com
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reviewed-by: Andrei Vagin <avagin@gmail.com>
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Cc: Alex Sierra <alex.sierra@amd.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Miroslaw <emmir@google.com>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Nadav Amit <namit@vmware.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Paul Gofman <pgofman@codeweavers.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Yun Zhou <yun.zhou@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-10-18 14:34:12 -07:00
..
damon Merge mm-hotfixes-stable into mm-stable to pick up depended-upon changes. 2023-10-18 14:32:58 -07:00
kasan kasan: disable kasan_non_canonical_hook() for HW tags 2023-10-18 12:12:41 -07:00
kfence LoongArch changes for v6.6 2023-09-08 12:16:52 -07:00
kmsan kmsan: introduce test_memcpy_initialized_gap() 2023-10-04 10:32:22 -07:00
backing-dev.c
balloon_compaction.c
bootmem_info.c
cma.c mm/cma: use nth_page() in place of direct struct page manipulation 2023-10-04 10:32:29 -07:00
cma.h
cma_debug.c
cma_sysfs.c
compaction.c mm/compaction: factor out code to test if we should run compaction for target order 2023-10-04 10:32:19 -07:00
debug.c
debug_page_alloc.c
debug_page_ref.c
debug_vm_pgtable.c
dmapool.c
dmapool_test.c
early_ioremap.c
fadvise.c
fail_page_alloc.c
failslab.c
filemap.c mm/filemap: remove hugetlb special casing in filemap.c 2023-10-16 15:44:38 -07:00
folio-compat.c
gup.c
gup_test.c
gup_test.h
highmem.c
hmm.c
huge_memory.c mm: memory: make numa_migrate_prep() to take a folio 2023-10-16 15:44:37 -07:00
hugetlb.c fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs 2023-10-18 14:34:12 -07:00
hugetlb_cgroup.c
hugetlb_vmemmap.c mm: hugetlb: skip initialization of gigantic tail struct pages if freed by HVO 2023-10-04 10:32:30 -07:00
hugetlb_vmemmap.h mm: hugetlb: skip initialization of gigantic tail struct pages if freed by HVO 2023-10-04 10:32:30 -07:00
hwpoison-inject.c
init-mm.c
internal.h mm: memory: make numa_migrate_prep() to take a folio 2023-10-16 15:44:37 -07:00
interval_tree.c
io-mapping.c
ioremap.c
Kconfig zswap: change zswap's default allocator to zsmalloc 2023-10-04 10:32:20 -07:00
Kconfig.debug
khugepaged.c
kmemleak.c
ksm.c mm/ksm: add pages_skipped metric 2023-10-16 15:44:39 -07:00
list_lru.c
maccess.c
madvise.c mm: remove remnants of SPLIT_RSS_COUNTING 2023-10-04 10:32:20 -07:00
Makefile mm: vmscan: move shrinker-related code into a separate file 2023-10-04 10:32:23 -07:00
mapping_dirty_helpers.c
memblock.c memblock: introduce MEMBLOCK_RSRV_NOINIT flag 2023-10-04 10:32:30 -07:00
memcontrol.c mm: memcg: normalize the value passed into memcg_rstat_updated() 2023-10-18 14:34:12 -07:00
memfd.c memfd: drop warning for missing exec-related flags 2023-10-04 10:32:22 -07:00
memory-failure.c mm: convert DAX lock/unlock page to lock/unlock folio 2023-10-04 10:32:20 -07:00
memory-tiers.c dax, kmem: calculate abstract distance with general interface 2023-10-16 15:44:39 -07:00
memory.c userfaultfd: UFFD_FEATURE_WP_ASYNC 2023-10-18 14:34:12 -07:00
memory_hotplug.c mm/memory_hotplug: use pfn math in place of direct struct page manipulation 2023-10-04 10:32:29 -07:00
mempolicy.c Merge mm-hotfixes-stable into mm-stable to pick up depended-upon changes. 2023-10-18 14:32:58 -07:00
mempool.c
memremap.c
memtest.c
migrate.c Merge mm-hotfixes-stable into mm-stable to pick up depended-upon changes. 2023-10-18 14:32:58 -07:00
migrate_device.c
mincore.c
mlock.c mm: mlock: update mlock_pte_range to handle large folio 2023-10-04 10:32:32 -07:00
mm_init.c mm: hugetlb: skip initialization of gigantic tail struct pages if freed by HVO 2023-10-04 10:32:30 -07:00
mm_slot.h
mmap.c Merge mm-hotfixes-stable into mm-stable to pick up depended-upon changes. 2023-10-18 14:32:58 -07:00
mmap_lock.c
mmu_gather.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c mm/mremap: allow moves within the same VMA for stack moves 2023-10-04 10:32:20 -07:00
msync.c
nommu.c
oom_kill.c
page-writeback.c mm/writeback: update filemap_dirty_folio() comment 2023-10-04 10:32:32 -07:00
page_alloc.c mm/page_alloc: correct start page when guard page debug is enabled 2023-10-06 14:11:38 -07:00
page_counter.c
page_ext.c
page_idle.c
page_io.c mm: memcg: add THP swap out info for anonymous reclaim 2023-10-04 10:32:27 -07:00
page_isolation.c
page_owner.c
page_poison.c
page_reporting.c
page_reporting.h
page_table_check.c
page_vma_mapped.c
pagewalk.c
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c
pgalloc-track.h
pgtable-generic.c
process_vm_access.c
ptdump.c
readahead.c
rmap.c mm: handle large folio when large folio in VM_LOCKED VMA range 2023-10-04 10:32:32 -07:00
rodata_test.c
secretmem.c
shmem.c mm/shmem: remove dead code can not be satisfied by "(CONFIG_SHMEM)&&(!(CONFIG_SHMEM))" 2023-10-04 10:32:22 -07:00
shmem_quota.c
show_mem.c mm: refactor si_mem_available() 2023-10-04 10:32:19 -07:00
shrinker.c mm: shrinker: convert shrinker_rwsem to mutex 2023-10-04 10:32:26 -07:00
shrinker_debug.c mm: shrinker: convert shrinker_rwsem to mutex 2023-10-04 10:32:26 -07:00
shuffle.c
shuffle.h
slab.c
slab.h
slab_common.c slab fixes for 6.6-rc4 2023-09-29 12:10:12 -07:00
slub.c
sparse-vmemmap.c
sparse.c
swap.c
swap.h
swap_cgroup.c
swap_slots.c
swap_state.c
swapfile.c
truncate.c
usercopy.c
userfaultfd.c
util.c
vmalloc.c mm: hugetlb: add huge page size param to set_huge_pte_at() 2023-09-29 17:20:47 -07:00
vmpressure.c
vmscan.c delayacct: add memory reclaim delay in get_page_from_freelist 2023-10-06 14:44:10 -07:00
vmstat.c mm/vmstat: use this_cpu_try_cmpxchg in mod_{zone,node}_state 2023-10-04 10:32:20 -07:00
workingset.c mm: workingset: dynamically allocate the mm-shadow shrinker 2023-10-04 10:32:24 -07:00
z3fold.c
zbud.c
zpool.c
zsmalloc.c zsmalloc: dynamically allocate the mm-zspool shrinker 2023-10-04 10:32:26 -07:00
zswap.c mm: zswap: fix pool refcount bug around shrink_worker() 2023-10-18 12:12:40 -07:00