Skip to content

Commit

Permalink
mm/damon: remove some unneeded function definitions in damon.h
Browse files Browse the repository at this point in the history
In damon.h 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 look cleaner.

If other files later need these functions, the prototypes can be added
to damon.h at that time.

[[email protected]: remove unnecessary function prototype position changes]
 Link: https://lkml.kernel.org/r/[email protected]

Link: https://lkml.kernel.org/r/45fd5b3ef6cce8e28dbc1c92f9dc845ccfc949d7.1636989871.git.xhao@linux.alibaba.com
Signed-off-by: Xin Hao <[email protected]>
Signed-off-by: SeongJae Park <[email protected]>
Reviewed-by: SeongJae Park <[email protected]>
Cc: Muchun Song <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Xin Hao authored and torvalds committed Jan 15, 2022
1 parent d720bbb commit cdeed00
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 deletions.
21 changes: 0 additions & 21 deletions include/linux/damon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

#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);

#endif /* CONFIG_DAMON_PADDR */

#endif /* _DAMON_H */
11 changes: 6 additions & 5 deletions mm/damon/paddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static void __damon_pa_prepare_access_check(struct damon_ctx *ctx,
damon_pa_mkold(r->sampling_addr);
}

void damon_pa_prepare_access_checks(struct damon_ctx *ctx)
static void damon_pa_prepare_access_checks(struct damon_ctx *ctx)
{
struct damon_target *t;
struct damon_region *r;
Expand Down Expand Up @@ -192,7 +192,7 @@ static void __damon_pa_check_access(struct damon_ctx *ctx,
last_addr = r->sampling_addr;
}

unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
{
struct damon_target *t;
struct damon_region *r;
Expand All @@ -213,7 +213,7 @@ bool damon_pa_target_valid(void *t)
return true;
}

int damon_pa_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
static int damon_pa_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
struct damon_region *r, struct damos *scheme)
{
unsigned long addr;
Expand Down Expand Up @@ -246,8 +246,9 @@ int damon_pa_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
return 0;
}

int damon_pa_scheme_score(struct damon_ctx *context, struct damon_target *t,
struct damon_region *r, struct damos *scheme)
static int damon_pa_scheme_score(struct damon_ctx *context,
struct damon_target *t, struct damon_region *r,
struct damos *scheme)
{
switch (scheme->action) {
case DAMOS_PAGEOUT:
Expand Down
18 changes: 10 additions & 8 deletions mm/damon/vaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static void __damon_va_init_regions(struct damon_ctx *ctx,
}

/* Initialize '->regions_list' of every target (task) */
void damon_va_init(struct damon_ctx *ctx)
static void damon_va_init(struct damon_ctx *ctx)
{
struct damon_target *t;

Expand All @@ -292,7 +292,8 @@ void damon_va_init(struct damon_ctx *ctx)
*
* Returns true if it is.
*/
static bool damon_intersect(struct damon_region *r, struct damon_addr_range *re)
static bool damon_intersect(struct damon_region *r,
struct damon_addr_range *re)
{
return !(r->ar.end <= re->start || re->end <= r->ar.start);
}
Expand Down Expand Up @@ -356,7 +357,7 @@ static void damon_va_apply_three_regions(struct damon_target *t,
/*
* Update regions for current memory mappings
*/
void damon_va_update(struct damon_ctx *ctx)
static void damon_va_update(struct damon_ctx *ctx)
{
struct damon_addr_range three_regions[3];
struct damon_target *t;
Expand Down Expand Up @@ -418,7 +419,7 @@ static void __damon_va_prepare_access_check(struct damon_ctx *ctx,
damon_va_mkold(mm, r->sampling_addr);
}

void damon_va_prepare_access_checks(struct damon_ctx *ctx)
static void damon_va_prepare_access_checks(struct damon_ctx *ctx)
{
struct damon_target *t;
struct mm_struct *mm;
Expand Down Expand Up @@ -539,7 +540,7 @@ static void __damon_va_check_access(struct damon_ctx *ctx,
last_addr = r->sampling_addr;
}

unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
static unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
{
struct damon_target *t;
struct mm_struct *mm;
Expand Down Expand Up @@ -603,7 +604,7 @@ static int damos_madvise(struct damon_target *target, struct damon_region *r,
}
#endif /* CONFIG_ADVISE_SYSCALLS */

int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
static int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
struct damon_region *r, struct damos *scheme)
{
int madv_action;
Expand Down Expand Up @@ -633,8 +634,9 @@ int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
return damos_madvise(t, r, madv_action);
}

int damon_va_scheme_score(struct damon_ctx *context, struct damon_target *t,
struct damon_region *r, struct damos *scheme)
static int damon_va_scheme_score(struct damon_ctx *context,
struct damon_target *t, struct damon_region *r,
struct damos *scheme)
{

switch (scheme->action) {
Expand Down

0 comments on commit cdeed00

Please sign in to comment.