Skip to contentSkip to conversation

mm-damon-implement-primitives-for-the-virtual-memory-address-spaces.patch removed from -mm tree

merged [email protected] 1 participant 1 message Sep 9, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm/damon: implement primitives for the virtual memory address spaces
has been removed from the -mm tree. Its filename was
mm-damon-implement-primitives-for-the-virtual-memory-address-spaces.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: SeongJae Park <[email protected]>
Subject: mm/damon: implement primitives for the virtual memory address spaces

This commit introduces a reference implementation of the address space specific low level primitives for the virtual address space, so that users of DAMON can easily monitor the data accesses on virtual address spaces of specific processes by simply configuring the implementation to be used by DAMON.

The low level primitives for the fundamental access monitoring are defined in two parts:

1. Identification of the monitoring target address range for the address space.
2. Access check of specific address range in the target space.

The reference implementation for the virtual address space does the works as below.

PTE Accessed-bit Based Access Check
-----------------------------------

The implementation uses PTE Accessed-bit for basic access checks. That is, it clears the bit for the next sampling target page and checks whether it is set again after one sampling period. This could disturb the reclaim logic. DAMON uses ``PG_idle`` and ``PG_young`` page flags to solve the conflict, as Idle page tracking does.

VMA-based Target Address Range Construction
-------------------------------------------

Only small parts in the super-huge virtual address space of the processes are mapped to physical memory and accessed. Thus, tracking the unmapped address regions is just wasteful. However, because DAMON can deal with some level of noise using the adaptive regions adjustment mechanism, tracking every mapping is not strictly required but could even incur a high overhead in some cases. That said, too huge unmapped areas inside the monitoring target should be removed to not take the time for the adaptive mechanism.

For the reason, this implementation converts the complex mappings to three distinct regions that cover every mapped area of the address space. Also, the two gaps between the three regions are the two biggest unmapped areas in the given address space. The two biggest unmapped areas would be the gap between the heap and the uppermost mmap()-ed region, and the gap between the lowermost mmap()-ed region and the stack in most of the cases. Because these gaps are exceptionally huge in usual address spaces, excluding these will be sufficient to make a reasonable trade-off. Below shows this in detail::

<heap>
<BIG UNMAPPED REGION 1>
<uppermost mmap()-ed region>
(small mmap()-ed regions and munmap()-ed regions) <lowermost mmap()-ed region>
<BIG UNMAPPED REGION 2>
<stack>

[[email protected]: mm/damon/vaddr.c needs highmem.h for kunmap_atomic()]
[[email protected]: remove unnecessary PAGE_EXTENSION setup]
[[email protected]: safely walk page table]
Cc Alexander Shishkin <[email protected]>
Cc Amit Shah <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Brendan Higgins <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc David Rientjes <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Fan Du <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Greg Thelen <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Joe Perches <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Marco Elver <[email protected]>
Cc Markus Boehme <[email protected]>
Cc Maximilian Heyne <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Steven Rostedt (VMware) <[email protected]>
Cc Vladimir Davydov <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 include/linux/damon.h |   13 
 mm/damon/Kconfig      |    8 
 mm/damon/Makefile     |    1 
 mm/damon/vaddr.c      |  665 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 687 insertions(+)
include/linux/damon.h renamed from include/linux/damon.h~mm-damon-implement-primitives-for-the-virtual-memory-address-spaces +13 -0
@@ -249,4 +249,17 @@ int damon_stop(struct damon_ctx **ctxs,
 
 #endif	/* CONFIG_DAMON */
 
+#ifdef CONFIG_DAMON_VADDR
+
+/* Monitoring primitives for virtual memory address spaces */
+void damon_va_init(struct damon_ctx *ctx);
+void damon_va_update(struct damon_ctx *ctx);
+void damon_va_prepare_access_checks(struct damon_ctx *ctx);
+unsigned int damon_va_check_accesses(struct damon_ctx *ctx);
+bool damon_va_target_valid(void *t);
+void damon_va_cleanup(struct damon_ctx *ctx);
+void damon_va_set_primitives(struct damon_ctx *ctx);
+
+#endif	/* CONFIG_DAMON_VADDR */
+
 #endif	/* _DAMON_H */
mm/damon/Kconfig renamed from mm/damon/Kconfig~mm-damon-implement-primitives-for-the-virtual-memory-address-spaces +8 -0
@@ -12,4 +12,12 @@ config DAMON
 	  See https://damonitor.github.io/doc/html/latest-damon/index.html for
 	  more information.
 
+config DAMON_VADDR
+	bool "Data access monitoring primitives for virtual address spaces"
+	depends on DAMON && MMU
+	select PAGE_IDLE_FLAG
+	help
+	  This builds the default data access monitoring primitives for DAMON
+	  that works for virtual address spaces.
+
 endmenu
mm/damon/Makefile renamed from mm/damon/Makefile~mm-damon-implement-primitives-for-the-virtual-memory-address-spaces +1 -0
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_DAMON)		:= core.o
+obj-$(CONFIG_DAMON_VADDR)	+= vaddr.o
mm/damon/vaddr.c new file +665 -0

665 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are