* [PATCH V3 0/4] mm/damon: Do some small changes
@ 2021-11-12 16:02 Xin Hao
2021-11-12 16:02 ` [PATCH V3 1/4] mm/damon: Unified access_check function naming rules Xin Hao
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Xin Hao @ 2021-11-12 16:02 UTC (permalink / raw)
To: sjpark; +Cc: xhao, akpm, linux-mm, linux-kernel
V2 -> V3
Fix commit information patch[2], as suggested by SeongJae Park
Add reviewed by SeongJae Park
https://lore.kernel.org/linux-mm/20211111082034.13323-1-sj@kernel.org/
V1 -> V2
Add reviewed by SeongJae Park
Add two new patches
V1:
https://lore.kernel.org/linux-mm/cover.1636546262.git.xhao@linux.alibaba.com/
Xin Hao (4):
mm/damon: Unified access_check function naming rules
mm/damon: Add 'age' of region tracepoint support
mm/damon/core: Using function abs() instead of diff_of()
mm/damon: Remove some no need func definitions in damon.h file
include/linux/damon.h | 25 ++-----------------------
include/trace/events/damon.h | 7 +++++--
mm/damon/core.c | 6 ++----
mm/damon/vaddr.c | 8 ++++----
4 files changed, 13 insertions(+), 33 deletions(-)
--
2.31.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH V3 1/4] mm/damon: Unified access_check function naming rules
2021-11-12 16:02 [PATCH V3 0/4] mm/damon: Do some small changes Xin Hao
@ 2021-11-12 16:02 ` Xin Hao
2021-11-12 16:02 ` [PATCH V3 2/4] mm/damon: Add 'age' of region tracepoint support Xin Hao
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Xin Hao @ 2021-11-12 16:02 UTC (permalink / raw)
To: sjpark; +Cc: xhao, akpm, linux-mm, linux-kernel
In damon/paddr.c file, two functions names start with underscore,
static void __damon_pa_prepare_access_check(struct damon_ctx *ctx,
struct damon_region *r)
static void __damon_pa_prepare_access_check(struct damon_ctx *ctx,
struct damon_region *r)
In damon/vaddr.c file, there are also two functions with the same function,
static void damon_va_prepare_access_check(struct damon_ctx *ctx,
struct mm_struct *mm, struct damon_region *r)
static void damon_va_check_access(struct damon_ctx *ctx,
struct mm_struct *mm, struct damon_region *r)
It makes sense to keep consistent, and it is not easy to be confused with
the function that call them.
Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
---
mm/damon/vaddr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index 35fe49080ee9..905e0fc8a8ec 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -409,7 +409,7 @@ static void damon_va_mkold(struct mm_struct *mm, unsigned long addr)
* Functions for the access checking of the regions
*/
-static void damon_va_prepare_access_check(struct damon_ctx *ctx,
+static void __damon_va_prepare_access_check(struct damon_ctx *ctx,
struct mm_struct *mm, struct damon_region *r)
{
r->sampling_addr = damon_rand(r->ar.start, r->ar.end);
@@ -428,7 +428,7 @@ void damon_va_prepare_access_checks(struct damon_ctx *ctx)
if (!mm)
continue;
damon_for_each_region(r, t)
- damon_va_prepare_access_check(ctx, mm, r);
+ __damon_va_prepare_access_check(ctx, mm, r);
mmput(mm);
}
}
@@ -514,7 +514,7 @@ static bool damon_va_young(struct mm_struct *mm, unsigned long addr,
* mm 'mm_struct' for the given virtual address space
* r the region to be checked
*/
-static void damon_va_check_access(struct damon_ctx *ctx,
+static void __damon_va_check_access(struct damon_ctx *ctx,
struct mm_struct *mm, struct damon_region *r)
{
static struct mm_struct *last_mm;
@@ -550,7 +550,7 @@ unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
if (!mm)
continue;
damon_for_each_region(r, t) {
- damon_va_check_access(ctx, mm, r);
+ __damon_va_check_access(ctx, mm, r);
max_nr_accesses = max(r->nr_accesses, max_nr_accesses);
}
mmput(mm);
--
2.31.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V3 2/4] mm/damon: Add 'age' of region tracepoint support
2021-11-12 16:02 [PATCH V3 0/4] mm/damon: Do some small changes Xin Hao
2021-11-12 16:02 ` [PATCH V3 1/4] mm/damon: Unified access_check function naming rules Xin Hao
@ 2021-11-12 16:02 ` Xin Hao
2021-11-12 16:02 ` [PATCH V3 3/4] mm/damon/core: Using function abs() instead of diff_of() Xin Hao
2021-11-12 16:02 ` [PATCH V3 4/4] mm/damon: Remove some no need func definitions in damon.h file Xin Hao
3 siblings, 0 replies; 8+ messages in thread
From: Xin Hao @ 2021-11-12 16:02 UTC (permalink / raw)
To: sjpark; +Cc: xhao, akpm, linux-mm, linux-kernel
In Damon, we can get age information by analyzing the nr_access change,
But short time sampling is not effective, we have to obtain enough data
for analysis through long time trace, this also means that we need to
consume more cpu resources and storage space.
Now the region add a new 'age' variable, we only need to get the change
of age value through a little time trace, for example, age has been
increasing to 141, but nr_access shows a value of 0 at the same time,
Through this,we can conclude that the region has a very low nr_access
value for a long time.
Fixes: 2fcb93629ad8 ("mm/damon: add a tracepoint")
Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
---
include/trace/events/damon.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h
index 2f422f4f1fb9..99ffa601e351 100644
--- a/include/trace/events/damon.h
+++ b/include/trace/events/damon.h
@@ -22,6 +22,7 @@ TRACE_EVENT(damon_aggregated,
__field(unsigned long, start)
__field(unsigned long, end)
__field(unsigned int, nr_accesses)
+ __field(unsigned int, age)
),
TP_fast_assign(
@@ -30,11 +31,13 @@ TRACE_EVENT(damon_aggregated,
__entry->start = r->ar.start;
__entry->end = r->ar.end;
__entry->nr_accesses = r->nr_accesses;
+ __entry->age = r->age;
),
- TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u",
+ TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u %u",
__entry->target_id, __entry->nr_regions,
- __entry->start, __entry->end, __entry->nr_accesses)
+ __entry->start, __entry->end,
+ __entry->nr_accesses, __entry->age)
);
#endif /* _TRACE_DAMON_H */
--
2.31.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V3 3/4] mm/damon/core: Using function abs() instead of diff_of()
2021-11-12 16:02 [PATCH V3 0/4] mm/damon: Do some small changes Xin Hao
2021-11-12 16:02 ` [PATCH V3 1/4] mm/damon: Unified access_check function naming rules Xin Hao
2021-11-12 16:02 ` [PATCH V3 2/4] mm/damon: Add 'age' of region tracepoint support Xin Hao
@ 2021-11-12 16:02 ` Xin Hao
2021-11-13 2:46 ` Muchun Song
2021-11-12 16:02 ` [PATCH V3 4/4] mm/damon: Remove some no need func definitions in damon.h file Xin Hao
3 siblings, 1 reply; 8+ messages in thread
From: Xin Hao @ 2021-11-12 16:02 UTC (permalink / raw)
To: sjpark; +Cc: xhao, akpm, linux-mm, linux-kernel
In kernel, we can use abs(a - b) to get the absolute value,
So there is no need to redefine a new one.
Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
---
mm/damon/core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index f37c17b53814..4d2c3a0c7c8a 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -757,8 +757,6 @@ static void damon_merge_two_regions(struct damon_target *t,
damon_destroy_region(r, t);
}
-#define diff_of(a, b) (a > b ? a - b : b - a)
-
/*
* Merge adjacent regions having similar access frequencies
*
@@ -772,13 +770,13 @@ static void damon_merge_regions_of(struct damon_target *t, unsigned int thres,
struct damon_region *r, *prev = NULL, *next;
damon_for_each_region_safe(r, next, t) {
- if (diff_of(r->nr_accesses, r->last_nr_accesses) > thres)
+ if (abs(r->nr_accesses - r->last_nr_accesses) > thres)
r->age = 0;
else
r->age++;
if (prev && prev->ar.end == r->ar.start &&
- diff_of(prev->nr_accesses, r->nr_accesses) <= thres &&
+ abs(prev->nr_accesses - r->nr_accesses) <= thres &&
sz_damon_region(prev) + sz_damon_region(r) <= sz_limit)
damon_merge_two_regions(t, prev, r);
else
--
2.31.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V3 4/4] mm/damon: Remove some no need func definitions in damon.h file
2021-11-12 16:02 [PATCH V3 0/4] mm/damon: Do some small changes Xin Hao
` (2 preceding siblings ...)
2021-11-12 16:02 ` [PATCH V3 3/4] mm/damon/core: Using function abs() instead of diff_of() Xin Hao
@ 2021-11-12 16:02 ` Xin Hao
2021-11-15 10:23 ` kernel test robot
2021-11-15 14:52 ` kernel test robot
3 siblings, 2 replies; 8+ messages in thread
From: Xin Hao @ 2021-11-12 16:02 UTC (permalink / raw)
To: sjpark; +Cc: xhao, akpm, linux-mm, linux-kernel
In the damon.h header file, some func definitions about VA & PA
can only be used in its own file, so there no need to define in
the header file, and the header file will looks cleaner.
If other files later call these functions, then put them to the
header file will not be late.
Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
---
include/linux/damon.h | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index 321de9d72360..8a73e825e0d5 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -461,34 +461,13 @@ int damon_stop(struct damon_ctx **ctxs, int nr_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);
-int damon_va_apply_scheme(struct damon_ctx *context, struct damon_target *t,
- struct damon_region *r, struct damos *scheme);
-int damon_va_scheme_score(struct damon_ctx *context, struct damon_target *t,
- struct damon_region *r, struct damos *scheme);
void damon_va_set_primitives(struct damon_ctx *ctx);
-
+bool damon_va_target_valid(void *t);
#endif /* CONFIG_DAMON_VADDR */
#ifdef CONFIG_DAMON_PADDR
-
-/* Monitoring primitives for the physical memory address space */
-void damon_pa_prepare_access_checks(struct damon_ctx *ctx);
-unsigned int damon_pa_check_accesses(struct damon_ctx *ctx);
-bool damon_pa_target_valid(void *t);
-int damon_pa_apply_scheme(struct damon_ctx *context, struct damon_target *t,
- struct damon_region *r, struct damos *scheme);
-int damon_pa_scheme_score(struct damon_ctx *context, struct damon_target *t,
- struct damon_region *r, struct damos *scheme);
void damon_pa_set_primitives(struct damon_ctx *ctx);
-
+bool damon_pa_target_valid(void *t);
#endif /* CONFIG_DAMON_PADDR */
#endif /* _DAMON_H */
--
2.31.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH V3 3/4] mm/damon/core: Using function abs() instead of diff_of()
2021-11-12 16:02 ` [PATCH V3 3/4] mm/damon/core: Using function abs() instead of diff_of() Xin Hao
@ 2021-11-13 2:46 ` Muchun Song
0 siblings, 0 replies; 8+ messages in thread
From: Muchun Song @ 2021-11-13 2:46 UTC (permalink / raw)
To: Xin Hao; +Cc: sjpark, Andrew Morton, Linux Memory Management List, LKML
On Sat, Nov 13, 2021 at 12:02 AM Xin Hao <xhao@linux.alibaba.com> wrote:
>
> In kernel, we can use abs(a - b) to get the absolute value,
> So there is no need to redefine a new one.
>
> Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
> Reviewed-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3 4/4] mm/damon: Remove some no need func definitions in damon.h file
2021-11-12 16:02 ` [PATCH V3 4/4] mm/damon: Remove some no need func definitions in damon.h file Xin Hao
@ 2021-11-15 10:23 ` kernel test robot
2021-11-15 14:52 ` kernel test robot
1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-11-15 10:23 UTC (permalink / raw)
To: Xin Hao, sjpark; +Cc: llvm, kbuild-all, xhao, akpm, linux-mm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 15572 bytes --]
Hi Xin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hnaz-mm/master]
url: https://github.com/0day-ci/linux/commits/Xin-Hao/mm-damon-Do-some-small-changes/20211113-000614
base: https://github.com/hnaz/linux-mm master
config: hexagon-randconfig-r041-20211115 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c9ed99dc122a1b52e3d9591ed817ccc826b08de0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xin-Hao/mm-damon-Do-some-small-changes/20211113-000614
git checkout c9ed99dc122a1b52e3d9591ed817ccc826b08de0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> mm/damon/vaddr.c:274:6: warning: no previous prototype for function 'damon_va_init' [-Wmissing-prototypes]
void damon_va_init(struct damon_ctx *ctx)
^
mm/damon/vaddr.c:274:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void damon_va_init(struct damon_ctx *ctx)
^
static
>> mm/damon/vaddr.c:358:6: warning: no previous prototype for function 'damon_va_update' [-Wmissing-prototypes]
void damon_va_update(struct damon_ctx *ctx)
^
mm/damon/vaddr.c:358:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void damon_va_update(struct damon_ctx *ctx)
^
static
>> mm/damon/vaddr.c:420:6: warning: no previous prototype for function 'damon_va_prepare_access_checks' [-Wmissing-prototypes]
void damon_va_prepare_access_checks(struct damon_ctx *ctx)
^
mm/damon/vaddr.c:420:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void damon_va_prepare_access_checks(struct damon_ctx *ctx)
^
static
>> mm/damon/vaddr.c:541:14: warning: no previous prototype for function 'damon_va_check_accesses' [-Wmissing-prototypes]
unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
^
mm/damon/vaddr.c:541:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
^
static
>> mm/damon/vaddr.c:605:5: warning: no previous prototype for function 'damon_va_apply_scheme' [-Wmissing-prototypes]
int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
^
mm/damon/vaddr.c:605:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
^
static
>> mm/damon/vaddr.c:636:5: warning: no previous prototype for function 'damon_va_scheme_score' [-Wmissing-prototypes]
int damon_va_scheme_score(struct damon_ctx *context, struct damon_target *t,
^
mm/damon/vaddr.c:636:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int damon_va_scheme_score(struct damon_ctx *context, struct damon_target *t,
^
static
6 warnings generated.
vim +/damon_va_init +274 mm/damon/vaddr.c
3f49584b262cf8 SeongJae Park 2021-09-07 272
3f49584b262cf8 SeongJae Park 2021-09-07 273 /* Initialize '->regions_list' of every target (task) */
3f49584b262cf8 SeongJae Park 2021-09-07 @274 void damon_va_init(struct damon_ctx *ctx)
3f49584b262cf8 SeongJae Park 2021-09-07 275 {
3f49584b262cf8 SeongJae Park 2021-09-07 276 struct damon_target *t;
3f49584b262cf8 SeongJae Park 2021-09-07 277
3f49584b262cf8 SeongJae Park 2021-09-07 278 damon_for_each_target(t, ctx) {
3f49584b262cf8 SeongJae Park 2021-09-07 279 /* the user may set the target regions as they want */
3f49584b262cf8 SeongJae Park 2021-09-07 280 if (!damon_nr_regions(t))
3f49584b262cf8 SeongJae Park 2021-09-07 281 __damon_va_init_regions(ctx, t);
3f49584b262cf8 SeongJae Park 2021-09-07 282 }
3f49584b262cf8 SeongJae Park 2021-09-07 283 }
3f49584b262cf8 SeongJae Park 2021-09-07 284
3f49584b262cf8 SeongJae Park 2021-09-07 285 /*
3f49584b262cf8 SeongJae Park 2021-09-07 286 * Functions for the dynamic monitoring target regions update
3f49584b262cf8 SeongJae Park 2021-09-07 287 */
3f49584b262cf8 SeongJae Park 2021-09-07 288
3f49584b262cf8 SeongJae Park 2021-09-07 289 /*
3f49584b262cf8 SeongJae Park 2021-09-07 290 * Check whether a region is intersecting an address range
3f49584b262cf8 SeongJae Park 2021-09-07 291 *
3f49584b262cf8 SeongJae Park 2021-09-07 292 * Returns true if it is.
3f49584b262cf8 SeongJae Park 2021-09-07 293 */
3f49584b262cf8 SeongJae Park 2021-09-07 294 static bool damon_intersect(struct damon_region *r, struct damon_addr_range *re)
3f49584b262cf8 SeongJae Park 2021-09-07 295 {
3f49584b262cf8 SeongJae Park 2021-09-07 296 return !(r->ar.end <= re->start || re->end <= r->ar.start);
3f49584b262cf8 SeongJae Park 2021-09-07 297 }
3f49584b262cf8 SeongJae Park 2021-09-07 298
3f49584b262cf8 SeongJae Park 2021-09-07 299 /*
3f49584b262cf8 SeongJae Park 2021-09-07 300 * Update damon regions for the three big regions of the given target
3f49584b262cf8 SeongJae Park 2021-09-07 301 *
3f49584b262cf8 SeongJae Park 2021-09-07 302 * t the given target
3f49584b262cf8 SeongJae Park 2021-09-07 303 * bregions the three big regions of the target
3f49584b262cf8 SeongJae Park 2021-09-07 304 */
3f49584b262cf8 SeongJae Park 2021-09-07 305 static void damon_va_apply_three_regions(struct damon_target *t,
3f49584b262cf8 SeongJae Park 2021-09-07 306 struct damon_addr_range bregions[3])
3f49584b262cf8 SeongJae Park 2021-09-07 307 {
3f49584b262cf8 SeongJae Park 2021-09-07 308 struct damon_region *r, *next;
966a1baa2355c1 Xin Hao 2021-10-28 309 unsigned int i;
3f49584b262cf8 SeongJae Park 2021-09-07 310
3f49584b262cf8 SeongJae Park 2021-09-07 311 /* Remove regions which are not in the three big regions now */
3f49584b262cf8 SeongJae Park 2021-09-07 312 damon_for_each_region_safe(r, next, t) {
3f49584b262cf8 SeongJae Park 2021-09-07 313 for (i = 0; i < 3; i++) {
3f49584b262cf8 SeongJae Park 2021-09-07 314 if (damon_intersect(r, &bregions[i]))
3f49584b262cf8 SeongJae Park 2021-09-07 315 break;
3f49584b262cf8 SeongJae Park 2021-09-07 316 }
3f49584b262cf8 SeongJae Park 2021-09-07 317 if (i == 3)
3f49584b262cf8 SeongJae Park 2021-09-07 318 damon_destroy_region(r, t);
3f49584b262cf8 SeongJae Park 2021-09-07 319 }
3f49584b262cf8 SeongJae Park 2021-09-07 320
3f49584b262cf8 SeongJae Park 2021-09-07 321 /* Adjust intersecting regions to fit with the three big regions */
3f49584b262cf8 SeongJae Park 2021-09-07 322 for (i = 0; i < 3; i++) {
3f49584b262cf8 SeongJae Park 2021-09-07 323 struct damon_region *first = NULL, *last;
3f49584b262cf8 SeongJae Park 2021-09-07 324 struct damon_region *newr;
3f49584b262cf8 SeongJae Park 2021-09-07 325 struct damon_addr_range *br;
3f49584b262cf8 SeongJae Park 2021-09-07 326
3f49584b262cf8 SeongJae Park 2021-09-07 327 br = &bregions[i];
3f49584b262cf8 SeongJae Park 2021-09-07 328 /* Get the first and last regions which intersects with br */
3f49584b262cf8 SeongJae Park 2021-09-07 329 damon_for_each_region(r, t) {
3f49584b262cf8 SeongJae Park 2021-09-07 330 if (damon_intersect(r, br)) {
3f49584b262cf8 SeongJae Park 2021-09-07 331 if (!first)
3f49584b262cf8 SeongJae Park 2021-09-07 332 first = r;
3f49584b262cf8 SeongJae Park 2021-09-07 333 last = r;
3f49584b262cf8 SeongJae Park 2021-09-07 334 }
3f49584b262cf8 SeongJae Park 2021-09-07 335 if (r->ar.start >= br->end)
3f49584b262cf8 SeongJae Park 2021-09-07 336 break;
3f49584b262cf8 SeongJae Park 2021-09-07 337 }
3f49584b262cf8 SeongJae Park 2021-09-07 338 if (!first) {
3f49584b262cf8 SeongJae Park 2021-09-07 339 /* no damon_region intersects with this big region */
3f49584b262cf8 SeongJae Park 2021-09-07 340 newr = damon_new_region(
3f49584b262cf8 SeongJae Park 2021-09-07 341 ALIGN_DOWN(br->start,
3f49584b262cf8 SeongJae Park 2021-09-07 342 DAMON_MIN_REGION),
3f49584b262cf8 SeongJae Park 2021-09-07 343 ALIGN(br->end, DAMON_MIN_REGION));
3f49584b262cf8 SeongJae Park 2021-09-07 344 if (!newr)
3f49584b262cf8 SeongJae Park 2021-09-07 345 continue;
3f49584b262cf8 SeongJae Park 2021-09-07 346 damon_insert_region(newr, damon_prev_region(r), r, t);
3f49584b262cf8 SeongJae Park 2021-09-07 347 } else {
3f49584b262cf8 SeongJae Park 2021-09-07 348 first->ar.start = ALIGN_DOWN(br->start,
3f49584b262cf8 SeongJae Park 2021-09-07 349 DAMON_MIN_REGION);
3f49584b262cf8 SeongJae Park 2021-09-07 350 last->ar.end = ALIGN(br->end, DAMON_MIN_REGION);
3f49584b262cf8 SeongJae Park 2021-09-07 351 }
3f49584b262cf8 SeongJae Park 2021-09-07 352 }
3f49584b262cf8 SeongJae Park 2021-09-07 353 }
3f49584b262cf8 SeongJae Park 2021-09-07 354
3f49584b262cf8 SeongJae Park 2021-09-07 355 /*
3f49584b262cf8 SeongJae Park 2021-09-07 356 * Update regions for current memory mappings
3f49584b262cf8 SeongJae Park 2021-09-07 357 */
3f49584b262cf8 SeongJae Park 2021-09-07 @358 void damon_va_update(struct damon_ctx *ctx)
3f49584b262cf8 SeongJae Park 2021-09-07 359 {
3f49584b262cf8 SeongJae Park 2021-09-07 360 struct damon_addr_range three_regions[3];
3f49584b262cf8 SeongJae Park 2021-09-07 361 struct damon_target *t;
3f49584b262cf8 SeongJae Park 2021-09-07 362
3f49584b262cf8 SeongJae Park 2021-09-07 363 damon_for_each_target(t, ctx) {
3f49584b262cf8 SeongJae Park 2021-09-07 364 if (damon_va_three_regions(t, three_regions))
3f49584b262cf8 SeongJae Park 2021-09-07 365 continue;
3f49584b262cf8 SeongJae Park 2021-09-07 366 damon_va_apply_three_regions(t, three_regions);
3f49584b262cf8 SeongJae Park 2021-09-07 367 }
3f49584b262cf8 SeongJae Park 2021-09-07 368 }
3f49584b262cf8 SeongJae Park 2021-09-07 369
3f49584b262cf8 SeongJae Park 2021-09-07 370 static int damon_mkold_pmd_entry(pmd_t *pmd, unsigned long addr,
3f49584b262cf8 SeongJae Park 2021-09-07 371 unsigned long next, struct mm_walk *walk)
3f49584b262cf8 SeongJae Park 2021-09-07 372 {
3f49584b262cf8 SeongJae Park 2021-09-07 373 pte_t *pte;
3f49584b262cf8 SeongJae Park 2021-09-07 374 spinlock_t *ptl;
3f49584b262cf8 SeongJae Park 2021-09-07 375
3f49584b262cf8 SeongJae Park 2021-09-07 376 if (pmd_huge(*pmd)) {
3f49584b262cf8 SeongJae Park 2021-09-07 377 ptl = pmd_lock(walk->mm, pmd);
3f49584b262cf8 SeongJae Park 2021-09-07 378 if (pmd_huge(*pmd)) {
3f49584b262cf8 SeongJae Park 2021-09-07 379 damon_pmdp_mkold(pmd, walk->mm, addr);
3f49584b262cf8 SeongJae Park 2021-09-07 380 spin_unlock(ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 381 return 0;
3f49584b262cf8 SeongJae Park 2021-09-07 382 }
3f49584b262cf8 SeongJae Park 2021-09-07 383 spin_unlock(ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 384 }
3f49584b262cf8 SeongJae Park 2021-09-07 385
3f49584b262cf8 SeongJae Park 2021-09-07 386 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
3f49584b262cf8 SeongJae Park 2021-09-07 387 return 0;
3f49584b262cf8 SeongJae Park 2021-09-07 388 pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 389 if (!pte_present(*pte))
3f49584b262cf8 SeongJae Park 2021-09-07 390 goto out;
3f49584b262cf8 SeongJae Park 2021-09-07 391 damon_ptep_mkold(pte, walk->mm, addr);
3f49584b262cf8 SeongJae Park 2021-09-07 392 out:
3f49584b262cf8 SeongJae Park 2021-09-07 393 pte_unmap_unlock(pte, ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 394 return 0;
3f49584b262cf8 SeongJae Park 2021-09-07 395 }
3f49584b262cf8 SeongJae Park 2021-09-07 396
aafaf6b3b9b77a Rikard Falkeborn 2021-10-28 397 static const struct mm_walk_ops damon_mkold_ops = {
3f49584b262cf8 SeongJae Park 2021-09-07 398 .pmd_entry = damon_mkold_pmd_entry,
3f49584b262cf8 SeongJae Park 2021-09-07 399 };
3f49584b262cf8 SeongJae Park 2021-09-07 400
3f49584b262cf8 SeongJae Park 2021-09-07 401 static void damon_va_mkold(struct mm_struct *mm, unsigned long addr)
3f49584b262cf8 SeongJae Park 2021-09-07 402 {
3f49584b262cf8 SeongJae Park 2021-09-07 403 mmap_read_lock(mm);
3f49584b262cf8 SeongJae Park 2021-09-07 404 walk_page_range(mm, addr, addr + 1, &damon_mkold_ops, NULL);
3f49584b262cf8 SeongJae Park 2021-09-07 405 mmap_read_unlock(mm);
3f49584b262cf8 SeongJae Park 2021-09-07 406 }
3f49584b262cf8 SeongJae Park 2021-09-07 407
3f49584b262cf8 SeongJae Park 2021-09-07 408 /*
3f49584b262cf8 SeongJae Park 2021-09-07 409 * Functions for the access checking of the regions
3f49584b262cf8 SeongJae Park 2021-09-07 410 */
3f49584b262cf8 SeongJae Park 2021-09-07 411
a7c7432ffce91f Xin Hao 2021-11-13 412 static void __damon_va_prepare_access_check(struct damon_ctx *ctx,
3f49584b262cf8 SeongJae Park 2021-09-07 413 struct mm_struct *mm, struct damon_region *r)
3f49584b262cf8 SeongJae Park 2021-09-07 414 {
3f49584b262cf8 SeongJae Park 2021-09-07 415 r->sampling_addr = damon_rand(r->ar.start, r->ar.end);
3f49584b262cf8 SeongJae Park 2021-09-07 416
3f49584b262cf8 SeongJae Park 2021-09-07 417 damon_va_mkold(mm, r->sampling_addr);
3f49584b262cf8 SeongJae Park 2021-09-07 418 }
3f49584b262cf8 SeongJae Park 2021-09-07 419
3f49584b262cf8 SeongJae Park 2021-09-07 @420 void damon_va_prepare_access_checks(struct damon_ctx *ctx)
3f49584b262cf8 SeongJae Park 2021-09-07 421 {
3f49584b262cf8 SeongJae Park 2021-09-07 422 struct damon_target *t;
3f49584b262cf8 SeongJae Park 2021-09-07 423 struct mm_struct *mm;
3f49584b262cf8 SeongJae Park 2021-09-07 424 struct damon_region *r;
3f49584b262cf8 SeongJae Park 2021-09-07 425
3f49584b262cf8 SeongJae Park 2021-09-07 426 damon_for_each_target(t, ctx) {
3f49584b262cf8 SeongJae Park 2021-09-07 427 mm = damon_get_mm(t);
3f49584b262cf8 SeongJae Park 2021-09-07 428 if (!mm)
3f49584b262cf8 SeongJae Park 2021-09-07 429 continue;
3f49584b262cf8 SeongJae Park 2021-09-07 430 damon_for_each_region(r, t)
a7c7432ffce91f Xin Hao 2021-11-13 431 __damon_va_prepare_access_check(ctx, mm, r);
3f49584b262cf8 SeongJae Park 2021-09-07 432 mmput(mm);
3f49584b262cf8 SeongJae Park 2021-09-07 433 }
3f49584b262cf8 SeongJae Park 2021-09-07 434 }
3f49584b262cf8 SeongJae Park 2021-09-07 435
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30005 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3 4/4] mm/damon: Remove some no need func definitions in damon.h file
2021-11-12 16:02 ` [PATCH V3 4/4] mm/damon: Remove some no need func definitions in damon.h file Xin Hao
2021-11-15 10:23 ` kernel test robot
@ 2021-11-15 14:52 ` kernel test robot
1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-11-15 14:52 UTC (permalink / raw)
To: Xin Hao, sjpark; +Cc: kbuild-all, xhao, akpm, linux-mm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 14406 bytes --]
Hi Xin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hnaz-mm/master]
url: https://github.com/0day-ci/linux/commits/Xin-Hao/mm-damon-Do-some-small-changes/20211113-000614
base: https://github.com/hnaz/linux-mm master
config: nios2-randconfig-r021-20211115 (attached as .config)
compiler: nios2-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c9ed99dc122a1b52e3d9591ed817ccc826b08de0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xin-Hao/mm-damon-Do-some-small-changes/20211113-000614
git checkout c9ed99dc122a1b52e3d9591ed817ccc826b08de0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> mm/damon/vaddr.c:274:6: warning: no previous prototype for 'damon_va_init' [-Wmissing-prototypes]
274 | void damon_va_init(struct damon_ctx *ctx)
| ^~~~~~~~~~~~~
>> mm/damon/vaddr.c:358:6: warning: no previous prototype for 'damon_va_update' [-Wmissing-prototypes]
358 | void damon_va_update(struct damon_ctx *ctx)
| ^~~~~~~~~~~~~~~
>> mm/damon/vaddr.c:420:6: warning: no previous prototype for 'damon_va_prepare_access_checks' [-Wmissing-prototypes]
420 | void damon_va_prepare_access_checks(struct damon_ctx *ctx)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> mm/damon/vaddr.c:541:14: warning: no previous prototype for 'damon_va_check_accesses' [-Wmissing-prototypes]
541 | unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
| ^~~~~~~~~~~~~~~~~~~~~~~
>> mm/damon/vaddr.c:605:5: warning: no previous prototype for 'damon_va_apply_scheme' [-Wmissing-prototypes]
605 | int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
| ^~~~~~~~~~~~~~~~~~~~~
>> mm/damon/vaddr.c:636:5: warning: no previous prototype for 'damon_va_scheme_score' [-Wmissing-prototypes]
636 | int damon_va_scheme_score(struct damon_ctx *context, struct damon_target *t,
| ^~~~~~~~~~~~~~~~~~~~~
vim +/damon_va_init +274 mm/damon/vaddr.c
3f49584b262cf8 SeongJae Park 2021-09-07 272
3f49584b262cf8 SeongJae Park 2021-09-07 273 /* Initialize '->regions_list' of every target (task) */
3f49584b262cf8 SeongJae Park 2021-09-07 @274 void damon_va_init(struct damon_ctx *ctx)
3f49584b262cf8 SeongJae Park 2021-09-07 275 {
3f49584b262cf8 SeongJae Park 2021-09-07 276 struct damon_target *t;
3f49584b262cf8 SeongJae Park 2021-09-07 277
3f49584b262cf8 SeongJae Park 2021-09-07 278 damon_for_each_target(t, ctx) {
3f49584b262cf8 SeongJae Park 2021-09-07 279 /* the user may set the target regions as they want */
3f49584b262cf8 SeongJae Park 2021-09-07 280 if (!damon_nr_regions(t))
3f49584b262cf8 SeongJae Park 2021-09-07 281 __damon_va_init_regions(ctx, t);
3f49584b262cf8 SeongJae Park 2021-09-07 282 }
3f49584b262cf8 SeongJae Park 2021-09-07 283 }
3f49584b262cf8 SeongJae Park 2021-09-07 284
3f49584b262cf8 SeongJae Park 2021-09-07 285 /*
3f49584b262cf8 SeongJae Park 2021-09-07 286 * Functions for the dynamic monitoring target regions update
3f49584b262cf8 SeongJae Park 2021-09-07 287 */
3f49584b262cf8 SeongJae Park 2021-09-07 288
3f49584b262cf8 SeongJae Park 2021-09-07 289 /*
3f49584b262cf8 SeongJae Park 2021-09-07 290 * Check whether a region is intersecting an address range
3f49584b262cf8 SeongJae Park 2021-09-07 291 *
3f49584b262cf8 SeongJae Park 2021-09-07 292 * Returns true if it is.
3f49584b262cf8 SeongJae Park 2021-09-07 293 */
3f49584b262cf8 SeongJae Park 2021-09-07 294 static bool damon_intersect(struct damon_region *r, struct damon_addr_range *re)
3f49584b262cf8 SeongJae Park 2021-09-07 295 {
3f49584b262cf8 SeongJae Park 2021-09-07 296 return !(r->ar.end <= re->start || re->end <= r->ar.start);
3f49584b262cf8 SeongJae Park 2021-09-07 297 }
3f49584b262cf8 SeongJae Park 2021-09-07 298
3f49584b262cf8 SeongJae Park 2021-09-07 299 /*
3f49584b262cf8 SeongJae Park 2021-09-07 300 * Update damon regions for the three big regions of the given target
3f49584b262cf8 SeongJae Park 2021-09-07 301 *
3f49584b262cf8 SeongJae Park 2021-09-07 302 * t the given target
3f49584b262cf8 SeongJae Park 2021-09-07 303 * bregions the three big regions of the target
3f49584b262cf8 SeongJae Park 2021-09-07 304 */
3f49584b262cf8 SeongJae Park 2021-09-07 305 static void damon_va_apply_three_regions(struct damon_target *t,
3f49584b262cf8 SeongJae Park 2021-09-07 306 struct damon_addr_range bregions[3])
3f49584b262cf8 SeongJae Park 2021-09-07 307 {
3f49584b262cf8 SeongJae Park 2021-09-07 308 struct damon_region *r, *next;
966a1baa2355c1 Xin Hao 2021-10-28 309 unsigned int i;
3f49584b262cf8 SeongJae Park 2021-09-07 310
3f49584b262cf8 SeongJae Park 2021-09-07 311 /* Remove regions which are not in the three big regions now */
3f49584b262cf8 SeongJae Park 2021-09-07 312 damon_for_each_region_safe(r, next, t) {
3f49584b262cf8 SeongJae Park 2021-09-07 313 for (i = 0; i < 3; i++) {
3f49584b262cf8 SeongJae Park 2021-09-07 314 if (damon_intersect(r, &bregions[i]))
3f49584b262cf8 SeongJae Park 2021-09-07 315 break;
3f49584b262cf8 SeongJae Park 2021-09-07 316 }
3f49584b262cf8 SeongJae Park 2021-09-07 317 if (i == 3)
3f49584b262cf8 SeongJae Park 2021-09-07 318 damon_destroy_region(r, t);
3f49584b262cf8 SeongJae Park 2021-09-07 319 }
3f49584b262cf8 SeongJae Park 2021-09-07 320
3f49584b262cf8 SeongJae Park 2021-09-07 321 /* Adjust intersecting regions to fit with the three big regions */
3f49584b262cf8 SeongJae Park 2021-09-07 322 for (i = 0; i < 3; i++) {
3f49584b262cf8 SeongJae Park 2021-09-07 323 struct damon_region *first = NULL, *last;
3f49584b262cf8 SeongJae Park 2021-09-07 324 struct damon_region *newr;
3f49584b262cf8 SeongJae Park 2021-09-07 325 struct damon_addr_range *br;
3f49584b262cf8 SeongJae Park 2021-09-07 326
3f49584b262cf8 SeongJae Park 2021-09-07 327 br = &bregions[i];
3f49584b262cf8 SeongJae Park 2021-09-07 328 /* Get the first and last regions which intersects with br */
3f49584b262cf8 SeongJae Park 2021-09-07 329 damon_for_each_region(r, t) {
3f49584b262cf8 SeongJae Park 2021-09-07 330 if (damon_intersect(r, br)) {
3f49584b262cf8 SeongJae Park 2021-09-07 331 if (!first)
3f49584b262cf8 SeongJae Park 2021-09-07 332 first = r;
3f49584b262cf8 SeongJae Park 2021-09-07 333 last = r;
3f49584b262cf8 SeongJae Park 2021-09-07 334 }
3f49584b262cf8 SeongJae Park 2021-09-07 335 if (r->ar.start >= br->end)
3f49584b262cf8 SeongJae Park 2021-09-07 336 break;
3f49584b262cf8 SeongJae Park 2021-09-07 337 }
3f49584b262cf8 SeongJae Park 2021-09-07 338 if (!first) {
3f49584b262cf8 SeongJae Park 2021-09-07 339 /* no damon_region intersects with this big region */
3f49584b262cf8 SeongJae Park 2021-09-07 340 newr = damon_new_region(
3f49584b262cf8 SeongJae Park 2021-09-07 341 ALIGN_DOWN(br->start,
3f49584b262cf8 SeongJae Park 2021-09-07 342 DAMON_MIN_REGION),
3f49584b262cf8 SeongJae Park 2021-09-07 343 ALIGN(br->end, DAMON_MIN_REGION));
3f49584b262cf8 SeongJae Park 2021-09-07 344 if (!newr)
3f49584b262cf8 SeongJae Park 2021-09-07 345 continue;
3f49584b262cf8 SeongJae Park 2021-09-07 346 damon_insert_region(newr, damon_prev_region(r), r, t);
3f49584b262cf8 SeongJae Park 2021-09-07 347 } else {
3f49584b262cf8 SeongJae Park 2021-09-07 348 first->ar.start = ALIGN_DOWN(br->start,
3f49584b262cf8 SeongJae Park 2021-09-07 349 DAMON_MIN_REGION);
3f49584b262cf8 SeongJae Park 2021-09-07 350 last->ar.end = ALIGN(br->end, DAMON_MIN_REGION);
3f49584b262cf8 SeongJae Park 2021-09-07 351 }
3f49584b262cf8 SeongJae Park 2021-09-07 352 }
3f49584b262cf8 SeongJae Park 2021-09-07 353 }
3f49584b262cf8 SeongJae Park 2021-09-07 354
3f49584b262cf8 SeongJae Park 2021-09-07 355 /*
3f49584b262cf8 SeongJae Park 2021-09-07 356 * Update regions for current memory mappings
3f49584b262cf8 SeongJae Park 2021-09-07 357 */
3f49584b262cf8 SeongJae Park 2021-09-07 @358 void damon_va_update(struct damon_ctx *ctx)
3f49584b262cf8 SeongJae Park 2021-09-07 359 {
3f49584b262cf8 SeongJae Park 2021-09-07 360 struct damon_addr_range three_regions[3];
3f49584b262cf8 SeongJae Park 2021-09-07 361 struct damon_target *t;
3f49584b262cf8 SeongJae Park 2021-09-07 362
3f49584b262cf8 SeongJae Park 2021-09-07 363 damon_for_each_target(t, ctx) {
3f49584b262cf8 SeongJae Park 2021-09-07 364 if (damon_va_three_regions(t, three_regions))
3f49584b262cf8 SeongJae Park 2021-09-07 365 continue;
3f49584b262cf8 SeongJae Park 2021-09-07 366 damon_va_apply_three_regions(t, three_regions);
3f49584b262cf8 SeongJae Park 2021-09-07 367 }
3f49584b262cf8 SeongJae Park 2021-09-07 368 }
3f49584b262cf8 SeongJae Park 2021-09-07 369
3f49584b262cf8 SeongJae Park 2021-09-07 370 static int damon_mkold_pmd_entry(pmd_t *pmd, unsigned long addr,
3f49584b262cf8 SeongJae Park 2021-09-07 371 unsigned long next, struct mm_walk *walk)
3f49584b262cf8 SeongJae Park 2021-09-07 372 {
3f49584b262cf8 SeongJae Park 2021-09-07 373 pte_t *pte;
3f49584b262cf8 SeongJae Park 2021-09-07 374 spinlock_t *ptl;
3f49584b262cf8 SeongJae Park 2021-09-07 375
3f49584b262cf8 SeongJae Park 2021-09-07 376 if (pmd_huge(*pmd)) {
3f49584b262cf8 SeongJae Park 2021-09-07 377 ptl = pmd_lock(walk->mm, pmd);
3f49584b262cf8 SeongJae Park 2021-09-07 378 if (pmd_huge(*pmd)) {
3f49584b262cf8 SeongJae Park 2021-09-07 379 damon_pmdp_mkold(pmd, walk->mm, addr);
3f49584b262cf8 SeongJae Park 2021-09-07 380 spin_unlock(ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 381 return 0;
3f49584b262cf8 SeongJae Park 2021-09-07 382 }
3f49584b262cf8 SeongJae Park 2021-09-07 383 spin_unlock(ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 384 }
3f49584b262cf8 SeongJae Park 2021-09-07 385
3f49584b262cf8 SeongJae Park 2021-09-07 386 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
3f49584b262cf8 SeongJae Park 2021-09-07 387 return 0;
3f49584b262cf8 SeongJae Park 2021-09-07 388 pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 389 if (!pte_present(*pte))
3f49584b262cf8 SeongJae Park 2021-09-07 390 goto out;
3f49584b262cf8 SeongJae Park 2021-09-07 391 damon_ptep_mkold(pte, walk->mm, addr);
3f49584b262cf8 SeongJae Park 2021-09-07 392 out:
3f49584b262cf8 SeongJae Park 2021-09-07 393 pte_unmap_unlock(pte, ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 394 return 0;
3f49584b262cf8 SeongJae Park 2021-09-07 395 }
3f49584b262cf8 SeongJae Park 2021-09-07 396
aafaf6b3b9b77a Rikard Falkeborn 2021-10-28 397 static const struct mm_walk_ops damon_mkold_ops = {
3f49584b262cf8 SeongJae Park 2021-09-07 398 .pmd_entry = damon_mkold_pmd_entry,
3f49584b262cf8 SeongJae Park 2021-09-07 399 };
3f49584b262cf8 SeongJae Park 2021-09-07 400
3f49584b262cf8 SeongJae Park 2021-09-07 401 static void damon_va_mkold(struct mm_struct *mm, unsigned long addr)
3f49584b262cf8 SeongJae Park 2021-09-07 402 {
3f49584b262cf8 SeongJae Park 2021-09-07 403 mmap_read_lock(mm);
3f49584b262cf8 SeongJae Park 2021-09-07 404 walk_page_range(mm, addr, addr + 1, &damon_mkold_ops, NULL);
3f49584b262cf8 SeongJae Park 2021-09-07 405 mmap_read_unlock(mm);
3f49584b262cf8 SeongJae Park 2021-09-07 406 }
3f49584b262cf8 SeongJae Park 2021-09-07 407
3f49584b262cf8 SeongJae Park 2021-09-07 408 /*
3f49584b262cf8 SeongJae Park 2021-09-07 409 * Functions for the access checking of the regions
3f49584b262cf8 SeongJae Park 2021-09-07 410 */
3f49584b262cf8 SeongJae Park 2021-09-07 411
a7c7432ffce91f Xin Hao 2021-11-13 412 static void __damon_va_prepare_access_check(struct damon_ctx *ctx,
3f49584b262cf8 SeongJae Park 2021-09-07 413 struct mm_struct *mm, struct damon_region *r)
3f49584b262cf8 SeongJae Park 2021-09-07 414 {
3f49584b262cf8 SeongJae Park 2021-09-07 415 r->sampling_addr = damon_rand(r->ar.start, r->ar.end);
3f49584b262cf8 SeongJae Park 2021-09-07 416
3f49584b262cf8 SeongJae Park 2021-09-07 417 damon_va_mkold(mm, r->sampling_addr);
3f49584b262cf8 SeongJae Park 2021-09-07 418 }
3f49584b262cf8 SeongJae Park 2021-09-07 419
3f49584b262cf8 SeongJae Park 2021-09-07 @420 void damon_va_prepare_access_checks(struct damon_ctx *ctx)
3f49584b262cf8 SeongJae Park 2021-09-07 421 {
3f49584b262cf8 SeongJae Park 2021-09-07 422 struct damon_target *t;
3f49584b262cf8 SeongJae Park 2021-09-07 423 struct mm_struct *mm;
3f49584b262cf8 SeongJae Park 2021-09-07 424 struct damon_region *r;
3f49584b262cf8 SeongJae Park 2021-09-07 425
3f49584b262cf8 SeongJae Park 2021-09-07 426 damon_for_each_target(t, ctx) {
3f49584b262cf8 SeongJae Park 2021-09-07 427 mm = damon_get_mm(t);
3f49584b262cf8 SeongJae Park 2021-09-07 428 if (!mm)
3f49584b262cf8 SeongJae Park 2021-09-07 429 continue;
3f49584b262cf8 SeongJae Park 2021-09-07 430 damon_for_each_region(r, t)
a7c7432ffce91f Xin Hao 2021-11-13 431 __damon_va_prepare_access_check(ctx, mm, r);
3f49584b262cf8 SeongJae Park 2021-09-07 432 mmput(mm);
3f49584b262cf8 SeongJae Park 2021-09-07 433 }
3f49584b262cf8 SeongJae Park 2021-09-07 434 }
3f49584b262cf8 SeongJae Park 2021-09-07 435
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33361 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-11-15 14:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 16:02 [PATCH V3 0/4] mm/damon: Do some small changes Xin Hao
2021-11-12 16:02 ` [PATCH V3 1/4] mm/damon: Unified access_check function naming rules Xin Hao
2021-11-12 16:02 ` [PATCH V3 2/4] mm/damon: Add 'age' of region tracepoint support Xin Hao
2021-11-12 16:02 ` [PATCH V3 3/4] mm/damon/core: Using function abs() instead of diff_of() Xin Hao
2021-11-13 2:46 ` Muchun Song
2021-11-12 16:02 ` [PATCH V3 4/4] mm/damon: Remove some no need func definitions in damon.h file Xin Hao
2021-11-15 10:23 ` kernel test robot
2021-11-15 14:52 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).