History

mm/damon: remove some unneeded function definitions in damon.h

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. [sj@kernel.org: remove unnecessary function prototype position changes] Link: https://lkml.kernel.org/r/20211118114827.20052-1-sj@kernel.org

Xin Hao committed 4 years ago

Commit cdeed001 parent d720bbb3 files · +16 −34Browse files

Unified · Split

3 files
  1. include/linux/damon.h +0 −21
  2. mm/damon/paddr.c +6 −5
  3. mm/damon/vaddr.c +10 −8
include/linux/damon.h+0−21
@@ -461,34 +461,13 @@ int damon_stop(struct damon_ctx **ctxs, int nr_ctxs); · 460 unmodified lines
461461 #endif /* CONFIG_DAMON */
462462
463463 #ifdef CONFIG_DAMON_VADDR
464−
465−/* Monitoring primitives for virtual memory address spaces */
466−void damon_va_init(struct damon_ctx *ctx);
467−void damon_va_update(struct damon_ctx *ctx);
468−void damon_va_prepare_access_checks(struct damon_ctx *ctx);
469−unsigned int damon_va_check_accesses(struct damon_ctx *ctx);
470464 bool damon_va_target_valid(void *t);
471−void damon_va_cleanup(struct damon_ctx *ctx);
472−int damon_va_apply_scheme(struct damon_ctx *context, struct damon_target *t,
473− struct damon_region *r, struct damos *scheme);
474−int damon_va_scheme_score(struct damon_ctx *context, struct damon_target *t,
475− struct damon_region *r, struct damos *scheme);
476465 void damon_va_set_primitives(struct damon_ctx *ctx);
477−
478466 #endif /* CONFIG_DAMON_VADDR */
479467
480468 #ifdef CONFIG_DAMON_PADDR
481−
482−/* Monitoring primitives for the physical memory address space */
483−void damon_pa_prepare_access_checks(struct damon_ctx *ctx);
484−unsigned int damon_pa_check_accesses(struct damon_ctx *ctx);
485469 bool damon_pa_target_valid(void *t);
486−int damon_pa_apply_scheme(struct damon_ctx *context, struct damon_target *t,
487− struct damon_region *r, struct damos *scheme);
488−int damon_pa_scheme_score(struct damon_ctx *context, struct damon_target *t,
489− struct damon_region *r, struct damos *scheme);
490470 void damon_pa_set_primitives(struct damon_ctx *ctx);
491−
492471 #endif /* CONFIG_DAMON_PADDR */
493472
494473 #endif /* _DAMON_H */
mm/damon/paddr.c+6−5
@@ -73,7 +73,7 @@ static void __damon_pa_prepare_access_check(struct damon_ctx *ctx, · 72 unmodified lines
7373 damon_pa_mkold(r->sampling_addr);
7474 }
7575
76−void damon_pa_prepare_access_checks(struct damon_ctx *ctx)
76+static void damon_pa_prepare_access_checks(struct damon_ctx *ctx)
7777 {
7878 struct damon_target *t;
7979 struct damon_region *r;
@@ -192,7 +192,7 @@ static void __damon_pa_check_access(struct damon_ctx *ctx, · 112 unmodified lines
192192 last_addr = r->sampling_addr;
193193 }
194194
195−unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
195+static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
196196 {
197197 struct damon_target *t;
198198 struct damon_region *r;
@@ -213,7 +213,7 @@ bool damon_pa_target_valid(void *t) · 14 unmodified lines
213213 return true;
214214 }
215215
216−int damon_pa_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
216+static int damon_pa_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
217217 struct damon_region *r, struct damos *scheme)
218218 {
219219 unsigned long addr;
@@ -246,8 +246,9 @@ int damon_pa_apply_scheme(struct damon_ctx *ctx, struct damon_target *t, · 26 unmodified lines
246246 return 0;
247247 }
248248
249−int damon_pa_scheme_score(struct damon_ctx *context, struct damon_target *t,
250− struct damon_region *r, struct damos *scheme)
249+static int damon_pa_scheme_score(struct damon_ctx *context,
250+ struct damon_target *t, struct damon_region *r,
251+ struct damos *scheme)
251252 {
252253 switch (scheme->action) {
253254 case DAMOS_PAGEOUT:
mm/damon/vaddr.c+10−8
@@ -272,7 +272,7 @@ static void __damon_va_init_regions(struct damon_ctx *ctx, · 271 unmodified lines
272272 }
273273
274274 /* Initialize '->regions_list' of every target (task) */
275−void damon_va_init(struct damon_ctx *ctx)
275+static void damon_va_init(struct damon_ctx *ctx)
276276 {
277277 struct damon_target *t;
278278
@@ -292,7 +292,8 @@ void damon_va_init(struct damon_ctx *ctx) · 13 unmodified lines
292292 *
293293 * Returns true if it is.
294294 */
295−static bool damon_intersect(struct damon_region *r, struct damon_addr_range *re)
295+static bool damon_intersect(struct damon_region *r,
296+ struct damon_addr_range *re)
296297 {
297298 return !(r->ar.end <= re->start || re->end <= r->ar.start);
298299 }
@@ -356,7 +357,7 @@ static void damon_va_apply_three_regions(struct damon_target *t, · 57 unmodified lines
356357 /*
357358 * Update regions for current memory mappings
358359 */
359−void damon_va_update(struct damon_ctx *ctx)
360+static void damon_va_update(struct damon_ctx *ctx)
360361 {
361362 struct damon_addr_range three_regions[3];
362363 struct damon_target *t;
@@ -418,7 +419,7 @@ static void __damon_va_prepare_access_check(struct damon_ctx *ctx, · 55 unmodified lines
418419 damon_va_mkold(mm, r->sampling_addr);
419420 }
420421
421−void damon_va_prepare_access_checks(struct damon_ctx *ctx)
422+static void damon_va_prepare_access_checks(struct damon_ctx *ctx)
422423 {
423424 struct damon_target *t;
424425 struct mm_struct *mm;
@@ -539,7 +540,7 @@ static void __damon_va_check_access(struct damon_ctx *ctx, · 114 unmodified lines
539540 last_addr = r->sampling_addr;
540541 }
541542
542−unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
543+static unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
543544 {
544545 struct damon_target *t;
545546 struct mm_struct *mm;
@@ -603,7 +604,7 @@ out: · 57 unmodified lines
603604 }
604605 #endif /* CONFIG_ADVISE_SYSCALLS */
605606
606−int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
607+static int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t,
607608 struct damon_region *r, struct damos *scheme)
608609 {
609610 int madv_action;
@@ -633,8 +634,9 @@ int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t, · 23 unmodified lines
633634 return damos_madvise(t, r, madv_action);
634635 }
635636
636−int damon_va_scheme_score(struct damon_ctx *context, struct damon_target *t,
637− struct damon_region *r, struct damos *scheme)
637+static int damon_va_scheme_score(struct damon_ctx *context,
638+ struct damon_target *t, struct damon_region *r,
639+ struct damos *scheme)
638640 {
639641
640642 switch (scheme->action) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t