All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Enze Li <lienze@kylinos.cn>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC PATCH 1/2] mm/damon/auto-tuning: introduce DAMON-based auto-tunning module
Date: Thu, 11 Dec 2025 16:50:15 +0800	[thread overview]
Message-ID: <202512111604.B1hpFdVs-lkp@intel.com> (raw)
In-Reply-To: <20251209145026.3263754-2-lienze@kylinos.cn>

Hi Enze,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]

url:    https://github.com/intel-lab-lkp/linux/commits/Enze-Li/mm-damon-auto-tuning-introduce-DAMON-based-auto-tunning-module/20251210-025514
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20251209145026.3263754-2-lienze%40kylinos.cn
patch subject: [RFC PATCH 1/2] mm/damon/auto-tuning: introduce DAMON-based auto-tunning module
config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20251211/202512111604.B1hpFdVs-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251211/202512111604.B1hpFdVs-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512111604.B1hpFdVs-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> mm/damon/auto-tuning.c:155:21: warning: variable 'adjust_priority' is uninitialized when used here [-Wuninitialized]
     155 |                 adjust_priority = adjust_priority * decay_factor / 10;
         |                                   ^~~~~~~~~~~~~~~
   mm/damon/auto-tuning.c:134:31: note: initialize the variable 'adjust_priority' to silence this warning
     134 |         unsigned long adjust_priority, metric;
         |                                      ^
         |                                       = 0
>> mm/damon/auto-tuning.c:283:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     283 |         if (!damon_initialized()) {
         |             ^~~~~~~~~~~~~~~~~~~~
   mm/damon/auto-tuning.c:291:9: note: uninitialized use occurs here
     291 |         return err;
         |                ^~~
   mm/damon/auto-tuning.c:283:2: note: remove the 'if' if its condition is always true
     283 |         if (!damon_initialized()) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   mm/damon/auto-tuning.c:281:9: note: initialize the variable 'err' to silence this warning
     281 |         int err;
         |                ^
         |                 = 0
   2 warnings generated.


vim +/adjust_priority +155 mm/damon/auto-tuning.c

   130	
   131	static bool _damon_auto_tuning_wmarks(struct damon_ctx *c, struct damos *s,
   132					      struct damon_target *t)
   133	{
   134		unsigned long adjust_priority, metric;
   135		int min = damon_targets_priority_min(c);
   136		int max = damon_targets_priority_max(c);
   137		int nr_targets = damon_nr_targets(c);
   138		int decay_factor = max_nr_targets - nr_targets;
   139	
   140		metric = global_zone_page_state(NR_FREE_PAGES) * 1000 /
   141			 totalram_pages();
   142	
   143		/*
   144		 * We are now ready to start adjusting the watermarks based on
   145		 * priority.  The goal is to set each target's watermark above the
   146		 * system's high watermark (to prevent it from triggering system-wide
   147		 * actions) and below its initial memory capacity, as determined by
   148		 * its importance.
   149		 */
   150		pr_debug("%s: metric=%ld\n", __func__, metric);
   151		/* TODO: Here, we need to use the system's high watermark value, and
   152		 * will temporarily substitute it with 100.
   153		 */
   154		if (nr_targets < max_nr_targets)
 > 155			adjust_priority = adjust_priority * decay_factor / 10;
   156		adjust_priority = (t->priority - min) * (metric - 100) / (max - min) + 100;
   157	
   158		s->wmarks.high = adjust_priority;
   159		s->wmarks.mid = adjust_priority;
   160		s->wmarks.low = 0;
   161		return true;
   162	}
   163	
   164	static bool damon_auto_tuning_wmarks(struct damon_ctx *c)
   165	{
   166		struct damon_target *t;
   167		struct damos *s, *next;
   168		struct damos_filter *f;
   169	
   170		damon_for_each_target(t, c) {
   171			if (c->ops.target_valid && c->ops.target_valid(t)) {
   172				damon_for_each_scheme_safe(s, next, c) {
   173					damos_for_each_core_filter(f, s) {
   174						if (damon_target_filter_match(c, f, t)) {
   175							pr_debug("%s: priority=%d(idx=%d)\n",
   176								 __func__, t->priority,
   177								 f->target_idx);
   178							_damon_auto_tuning_wmarks(c, s, t);
   179						}
   180					}
   181				}
   182			}
   183		}
   184		damon_targets_print_info(c);
   185		return true;
   186	}
   187	
   188	static bool damon_targets_auto_tuning_tick(struct damon_ctx *c,
   189						   bool init_wmarks)
   190	{
   191		int nr_targets = 0;
   192		unsigned long cur_jiffies = jiffies;
   193		static unsigned long last_jiffies;
   194	
   195		if (last_jiffies != 0) {
   196			if (time_is_after_jiffies(last_jiffies + 5 * HZ))
   197				return false;
   198		}
   199	
   200		pr_debug("%s %ld %ld\n", __func__, cur_jiffies, last_jiffies + 5 * HZ);
   201		last_jiffies = cur_jiffies;
   202	
   203		/*
   204		 * Any change in the number of targets necessitates a recalibration of
   205		 * the per-task watermarks.
   206		 */
   207		nr_targets = damon_nr_targets(auto_ctx);
   208		if (auto_targets != nr_targets) {
   209			damon_auto_tuning_wmarks(auto_ctx);
   210			auto_targets = nr_targets;
   211		}
   212	
   213		if (max_nr_targets < auto_targets)
   214			max_nr_targets = auto_targets;
   215	
   216		return true;
   217	}
   218	
   219	static bool damon_targets_auto_tuning_init(struct damon_ctx *c)
   220	{
   221		struct damon_target *t;
   222		struct damos *s, *next, *new_scheme;
   223		struct damos_filter *new_filter;
   224		int i = 0;
   225	
   226		init_auto_tuning = true;
   227		auto_ctx = c;
   228	
   229		damon_for_each_scheme_safe(s, next, c)
   230			damon_destroy_scheme(s);
   231	
   232		damon_for_each_target(t, c) {
   233			new_scheme = damon_auto_tuning_new_scheme();
   234			if (!new_scheme)
   235				return -ENOMEM;
   236	
   237			new_filter = damos_new_filter(DAMOS_FILTER_TYPE_TARGET, true, true);
   238			if (!new_filter)
   239				return -ENOMEM;
   240			new_filter->target_idx = i++;
   241	
   242			damos_add_filter(new_scheme, new_filter);
   243			damon_add_scheme(c, new_scheme);
   244	
   245			pr_info("\t add scheme %d\n", auto_targets);
   246			auto_targets++;
   247		}
   248	
   249		max_nr_targets = auto_targets;
   250	
   251		damon_targets_print_info(c);
   252		damon_auto_tuning_wmarks(c);
   253		damon_targets_print_info(c);
   254	
   255		return true;
   256	}
   257	
   258	static bool damon_targets_priority_enabled(struct damon_ctx *c)
   259	{
   260		struct damon_target *t;
   261	
   262		damon_for_each_target(t, c)
   263			if (t->priority > 0)
   264				return true;
   265		return false;
   266	}
   267	
   268	bool kdamond_targets_auto_tuning(struct damon_ctx *c)
   269	{
   270		if (damon_targets_priority_enabled(c)) {
   271			if (!init_auto_tuning)
   272				damon_targets_auto_tuning_init(c);
   273			else
   274				damon_targets_auto_tuning_tick(c, false);
   275		}
   276		return false;
   277	}
   278	
   279	static int __init damon_auto_tuning_init(void)
   280	{
   281		int err;
   282	
 > 283		if (!damon_initialized()) {
   284			err = -ENOMEM;
   285			goto out;
   286		}
   287		init_metric = global_zone_page_state(NR_FREE_PAGES) * 1000 /
   288			      totalram_pages();
   289		pr_info("%s init_metric=%ld\n", __func__,  init_metric);
   290	out:
   291		return err;
   292	}
   293	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2025-12-11  8:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 14:50 [RFC PATCH 0/2] mm/damon: Introduce basic auto-tuning framework with priority support Enze Li
2025-12-09 14:50 ` [RFC PATCH 1/2] mm/damon/auto-tuning: introduce DAMON-based auto-tunning module Enze Li
2025-12-11  8:50   ` kernel test robot [this message]
2025-12-09 14:50 ` [RFC PATCH 2/2] mm/damon/sysfs: introduce priority sysfs interface Enze Li
2025-12-12  3:38 ` [RFC PATCH 0/2] mm/damon: Introduce basic auto-tuning framework with priority support SeongJae Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202512111604.B1hpFdVs-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=lienze@kylinos.cn \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.