Commit 09876ae7 authored by Kaixu Xia's avatar Kaixu Xia Committed by Andrew Morton

mm/damon: simplify the parameter passing for 'check_accesses'

Patch series "mm/damon: Simplify the damon regions access check", v2.

This patchset simplifies the operations when checking the damon regions
accesses.


This patch (of 2):

The parameter 'struct damon_ctx *ctx' isn't used in the functions
__damon_{p,v}a_check_access(), so we can remove it and simplify the
parameter passing.

Link: https://lkml.kernel.org/r/1661590971-20893-1-git-send-email-kaixuxia@tencent.com
Link: https://lkml.kernel.org/r/1661590971-20893-2-git-send-email-kaixuxia@tencent.comSigned-off-by: default avatarKaixu Xia <kaixuxia@tencent.com>
Reviewed-by: default avatarSeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent b4a0215e
...@@ -166,8 +166,7 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *page_sz) ...@@ -166,8 +166,7 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *page_sz)
return result.accessed; return result.accessed;
} }
static void __damon_pa_check_access(struct damon_ctx *ctx, static void __damon_pa_check_access(struct damon_region *r)
struct damon_region *r)
{ {
static unsigned long last_addr; static unsigned long last_addr;
static unsigned long last_page_sz = PAGE_SIZE; static unsigned long last_page_sz = PAGE_SIZE;
...@@ -196,7 +195,7 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx) ...@@ -196,7 +195,7 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
damon_for_each_target(t, ctx) { damon_for_each_target(t, ctx) {
damon_for_each_region(r, t) { damon_for_each_region(r, t) {
__damon_pa_check_access(ctx, r); __damon_pa_check_access(r);
max_nr_accesses = max(r->nr_accesses, max_nr_accesses); max_nr_accesses = max(r->nr_accesses, max_nr_accesses);
} }
} }
......
...@@ -542,8 +542,8 @@ static bool damon_va_young(struct mm_struct *mm, unsigned long addr, ...@@ -542,8 +542,8 @@ static bool damon_va_young(struct mm_struct *mm, unsigned long addr,
* mm 'mm_struct' for the given virtual address space * mm 'mm_struct' for the given virtual address space
* r the region to be checked * r the region to be checked
*/ */
static void __damon_va_check_access(struct damon_ctx *ctx, static void __damon_va_check_access(struct mm_struct *mm,
struct mm_struct *mm, struct damon_region *r) struct damon_region *r)
{ {
static struct mm_struct *last_mm; static struct mm_struct *last_mm;
static unsigned long last_addr; static unsigned long last_addr;
...@@ -578,7 +578,7 @@ static unsigned int damon_va_check_accesses(struct damon_ctx *ctx) ...@@ -578,7 +578,7 @@ static unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
if (!mm) if (!mm)
continue; continue;
damon_for_each_region(r, t) { damon_for_each_region(r, t) {
__damon_va_check_access(ctx, mm, r); __damon_va_check_access(mm, r);
max_nr_accesses = max(r->nr_accesses, max_nr_accesses); max_nr_accesses = max(r->nr_accesses, max_nr_accesses);
} }
mmput(mm); mmput(mm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment