linux/mm/damon
Ryan Roberts 23fbff67b0 mm/damon/ops-common: atomically test and clear young on ptes and pmds
commit c11d34fa13 upstream.

It is racy to non-atomically read a pte, then clear the young bit, then
write it back as this could discard dirty information.  Further, it is bad
practice to directly set a pte entry within a table.  Instead clearing
young must go through the arch-provided helper,
ptep_test_and_clear_young() to ensure it is modified atomically and to
give the arch code visibility and allow it to check (and potentially
modify) the operation.

Link: https://lkml.kernel.org/r/20230602092949.545577-3-ryan.roberts@arm.com
Fixes: 3f49584b26 ("mm/damon: implement primitives for the virtual memory address spaces").
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-19 16:22:11 +02:00
..
core-test.h mm/damon/core-test: test damon_set_regions 2022-10-03 14:03:06 -07:00
core.c - Alistair Popple has a series which addresses a race which causes page 2022-10-14 12:28:43 -07:00
dbgfs-test.h mm/damon/dbgfs-test: fix is_target_id() change 2022-03-22 15:57:12 -07:00
dbgfs.c mm/damon/dbgfs: check if rm_contexts input is for a real context 2022-11-08 15:57:25 -08:00
Kconfig mm/damon/Kconfig: notify debugfs deprecation plan 2022-10-03 14:03:06 -07:00
lru_sort.c mm/damon: deduplicate damon_{reclaim,lru_sort}_apply_parameters() 2022-10-03 14:03:31 -07:00
Makefile mm/damon: introduce DAMON-based LRU-lists Sorting 2022-07-03 18:08:43 -07:00
modules-common.h mm/damon/modules-common: implement damos time quota params generator 2022-10-03 14:03:13 -07:00
ops-common.c mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-07-19 16:22:11 +02:00
ops-common.h mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-07-19 16:22:11 +02:00
paddr.c mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-07-19 16:22:11 +02:00
reclaim.c mm/damon: deduplicate damon_{reclaim,lru_sort}_apply_parameters() 2022-10-03 14:03:31 -07:00
sysfs.c mm/damon/sysfs: fix wrong empty schemes assumption under online tuning in damon_sysfs_set_schemes() 2022-11-30 14:49:41 -08:00
vaddr-test.h damon: convert __damon_va_three_regions to use the VMA iterator 2022-09-26 19:46:16 -07:00
vaddr.c mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-07-19 16:22:11 +02:00