Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/core: remove damon_callback

All damon_callback usages are replicated by damon_call() and damos_walk().
Time to say goodbye. Remove damon_callback.

Link: https://lkml.kernel.org/r/20250712195016.151108-15-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
5add26c0 0c96decc

+8 -49
+1 -30
include/linux/damon.h
··· 629 629 void (*cleanup)(struct damon_ctx *context); 630 630 }; 631 631 632 - /** 633 - * struct damon_callback - Monitoring events notification callbacks. 634 - * 635 - * @after_wmarks_check: Called after each schemes' watermarks check. 636 - * @after_aggregation: Called after each aggregation. 637 - * @before_terminate: Called before terminating the monitoring. 638 - * 639 - * The monitoring thread (&damon_ctx.kdamond) calls @before_terminate just 640 - * before finishing the monitoring. 641 - * 642 - * The monitoring thread calls @after_wmarks_check after each DAMON-based 643 - * operation schemes' watermarks check. If users need to make changes to the 644 - * attributes of the monitoring context while it's deactivated due to the 645 - * watermarks, this is the good place to do. 646 - * 647 - * The monitoring thread calls @after_aggregation for each of the aggregation 648 - * intervals. Therefore, users can safely access the monitoring results 649 - * without additional protection. For the reason, users are recommended to use 650 - * these callback for the accesses to the results. 651 - * 652 - * If any callback returns non-zero, monitoring stops. 653 - */ 654 - struct damon_callback { 655 - int (*after_wmarks_check)(struct damon_ctx *context); 656 - int (*after_aggregation)(struct damon_ctx *context); 657 - void (*before_terminate)(struct damon_ctx *context); 658 - }; 659 - 660 632 /* 661 633 * struct damon_call_control - Control damon_call(). 662 634 * ··· 699 727 * ``mmap()`` calls from the application, in case of virtual memory monitoring) 700 728 * and applies the changes for each @ops_update_interval. All time intervals 701 729 * are in micro-seconds. Please refer to &struct damon_operations and &struct 702 - * damon_callback for more detail. 730 + * damon_call_control for more detail. 703 731 */ 704 732 struct damon_attrs { 705 733 unsigned long sample_interval; ··· 788 816 struct mutex kdamond_lock; 789 817 790 818 struct damon_operations ops; 791 - struct damon_callback callback; 792 819 793 820 struct list_head adaptive_targets; 794 821 struct list_head schemes;
+7 -19
mm/damon/core.c
··· 680 680 * @attrs: monitoring attributes 681 681 * 682 682 * This function should be called while the kdamond is not running, an access 683 - * check results aggregation is not ongoing (e.g., from &struct 684 - * damon_callback->after_aggregation or &struct 685 - * damon_callback->after_wmarks_check callbacks), or from damon_call(). 683 + * check results aggregation is not ongoing (e.g., from damon_call(). 686 684 * 687 685 * Every time interval is in micro-seconds. 688 686 * ··· 776 778 * DAMON contexts, instead of manual in-place updates. 777 779 * 778 780 * This function should be called from parameters-update safe context, like 779 - * DAMON callbacks. 781 + * damon_call(). 780 782 */ 781 783 int damos_commit_quota_goals(struct damos_quota *dst, struct damos_quota *src) 782 784 { ··· 1175 1177 * in-place updates. 1176 1178 * 1177 1179 * This function should be called from parameters-update safe context, like 1178 - * DAMON callbacks. 1180 + * damon_call(). 1179 1181 */ 1180 1182 int damon_commit_ctx(struct damon_ctx *dst, struct damon_ctx *src) 1181 1183 { ··· 2482 2484 2483 2485 kdamond_usleep(min_wait_time); 2484 2486 2485 - if (ctx->callback.after_wmarks_check && 2486 - ctx->callback.after_wmarks_check(ctx)) 2487 - break; 2488 2487 kdamond_call(ctx, false); 2489 2488 damos_walk_cancel(ctx); 2490 2489 } ··· 2538 2543 while (!kdamond_need_stop(ctx)) { 2539 2544 /* 2540 2545 * ctx->attrs and ctx->next_{aggregation,ops_update}_sis could 2541 - * be changed from after_wmarks_check() or after_aggregation() 2542 - * callbacks. Read the values here, and use those for this 2543 - * iteration. That is, damon_set_attrs() updated new values 2544 - * are respected from next iteration. 2546 + * be changed from kdamond_call(). Read the values here, and 2547 + * use those for this iteration. That is, damon_set_attrs() 2548 + * updated new values are respected from next iteration. 2545 2549 */ 2546 2550 unsigned long next_aggregation_sis = ctx->next_aggregation_sis; 2547 2551 unsigned long next_ops_update_sis = ctx->next_ops_update_sis; ··· 2558 2564 if (ctx->ops.check_accesses) 2559 2565 max_nr_accesses = ctx->ops.check_accesses(ctx); 2560 2566 2561 - if (ctx->passed_sample_intervals >= next_aggregation_sis) { 2567 + if (ctx->passed_sample_intervals >= next_aggregation_sis) 2562 2568 kdamond_merge_regions(ctx, 2563 2569 max_nr_accesses / 10, 2564 2570 sz_limit); 2565 - if (ctx->callback.after_aggregation && 2566 - ctx->callback.after_aggregation(ctx)) 2567 - break; 2568 - } 2569 2571 2570 2572 /* 2571 2573 * do kdamond_call() and kdamond_apply_schemes() after ··· 2627 2637 damon_destroy_region(r, t); 2628 2638 } 2629 2639 2630 - if (ctx->callback.before_terminate) 2631 - ctx->callback.before_terminate(ctx); 2632 2640 if (ctx->ops.cleanup) 2633 2641 ctx->ops.cleanup(ctx); 2634 2642 kfree(ctx->regions_score_histogram);