linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Stefan Roesch <shr@devkernel.io>, kernel-team@fb.com
Cc: oe-kbuild-all@lists.linux.dev, shr@devkernel.io,
	akpm@linux-foundation.org, david@redhat.com, hannes@cmpxchg.org,
	riel@surriel.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH v3 1/4] mm/ksm: add ksm advisor
Date: Wed, 6 Dec 2023 23:17:02 +0800	[thread overview]
Message-ID: <202312062353.lBYSA7Eb-lkp@intel.com> (raw)
In-Reply-To: <20231204234906.1237478-2-shr@devkernel.io>

Hi Stefan,

kernel test robot noticed the following build errors:

[auto build test ERROR on 12d04a7bf0da67321229d2bc8b1a7074d65415a9]

url:    https://github.com/intel-lab-lkp/linux/commits/Stefan-Roesch/mm-ksm-add-ksm-advisor/20231205-075118
base:   12d04a7bf0da67321229d2bc8b1a7074d65415a9
patch link:    https://lore.kernel.org/r/20231204234906.1237478-2-shr%40devkernel.io
patch subject: [PATCH v3 1/4] mm/ksm: add ksm advisor
config: i386-randconfig-011-20231206 (https://download.01.org/0day-ci/archive/20231206/202312062353.lBYSA7Eb-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231206/202312062353.lBYSA7Eb-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/202312062353.lBYSA7Eb-lkp@intel.com/

All errors (new ones prefixed by >>):

   ld: mm/ksm.o: in function `scan_time_advisor':
>> mm/ksm.c:423: undefined reference to `__divdi3'
>> ld: mm/ksm.c:435: undefined reference to `__divdi3'
   ld: mm/ksm.c:428: undefined reference to `__divdi3'


vim +423 mm/ksm.c

   383	
   384	/*
   385	 * The scan time advisor is based on the current scan rate and the target
   386	 * scan rate.
   387	 *
   388	 *      new_pages_to_scan = pages_to_scan * (scan_time / target_scan_time)
   389	 *
   390	 * To avoid pertubations it calculates a change factor of previous changes.
   391	 * A new change factor is calculated for each iteration and it uses an
   392	 * exponentially weighted moving average. The new pages_to_scan value is
   393	 * multiplied with that change factor:
   394	 *
   395	 *      new_pages_to_scan *= change facor
   396	 *
   397	 * In addition the new pages_to_scan value is capped by the max and min
   398	 * limits.
   399	 */
   400	static void scan_time_advisor(void)
   401	{
   402		unsigned int cpu_percent;
   403		unsigned long cpu_time;
   404		unsigned long cpu_time_diff;
   405		unsigned long cpu_time_diff_ms;
   406		unsigned long pages;
   407		unsigned long per_page_cost;
   408		unsigned long factor;
   409		unsigned long change;
   410		unsigned long last_scan_time;
   411		s64 scan_time;
   412	
   413		/* Convert scan time to seconds */
   414		scan_time = advisor_stop_scan();
   415		scan_time = div_s64(scan_time, MSEC_PER_SEC);
   416		scan_time = scan_time ? scan_time : 1;
   417	
   418		/* Calculate CPU consumption of ksmd background thread */
   419		cpu_time = task_sched_runtime(current);
   420		cpu_time_diff = cpu_time - advisor_ctx.cpu_time;
   421		cpu_time_diff_ms = cpu_time_diff / 1000 / 1000;
   422	
 > 423		cpu_percent = (cpu_time_diff_ms * 100) / (scan_time * 1000);
   424		cpu_percent = cpu_percent ? cpu_percent : 1;
   425		last_scan_time = prev_scan_time(&advisor_ctx, scan_time);
   426	
   427		/* Calculate scan time as percentage of target scan time */
   428		factor = ksm_advisor_target_scan_time * 100 / scan_time;
   429		factor = factor ? factor : 1;
   430	
   431		/*
   432		 * Calculate scan time as percentage of last scan time and use
   433		 * exponentially weighted average to smooth it
   434		 */
 > 435		change = scan_time * 100 / last_scan_time;
   436		change = change ? change : 1;
   437		change = ewma(advisor_ctx.change, change);
   438	
   439		/* Calculate new scan rate based on target scan rate. */
   440		pages = ksm_thread_pages_to_scan * 100 / factor;
   441		/* Update pages_to_scan by weighted change percentage. */
   442		pages = pages * change / 100;
   443	
   444		/* Cap new pages_to_scan value */
   445		per_page_cost = ksm_thread_pages_to_scan / cpu_percent;
   446		per_page_cost = per_page_cost ? per_page_cost : 1;
   447	
   448		pages = min(pages, per_page_cost * ksm_advisor_max_cpu);
   449		pages = max(pages, per_page_cost * ksm_advisor_min_cpu);
   450		pages = min(pages, ksm_advisor_max_pages);
   451	
   452		/* Update advisor context */
   453		advisor_ctx.change = change;
   454		advisor_ctx.scan_time = scan_time;
   455		advisor_ctx.cpu_time = cpu_time;
   456	
   457		ksm_thread_pages_to_scan = pages;
   458	}
   459	

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


  reply	other threads:[~2023-12-06 15:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 23:49 [PATCH v3 0/4] mm/ksm: Add " Stefan Roesch
2023-12-04 23:49 ` [PATCH v3 1/4] mm/ksm: add " Stefan Roesch
2023-12-06 15:17   ` kernel test robot [this message]
2023-12-12 13:44   ` David Hildenbrand
2023-12-12 18:32     ` Stefan Roesch
2023-12-04 23:49 ` [PATCH v3 2/4] mm/ksm: add sysfs knobs for advisor Stefan Roesch
2023-12-12 13:45   ` David Hildenbrand
2023-12-12 18:02     ` Stefan Roesch
2023-12-12 18:07       ` David Hildenbrand
2023-12-12 18:27         ` Stefan Roesch
2023-12-04 23:49 ` [PATCH v3 3/4] mm/ksm: add tracepoint for ksm advisor Stefan Roesch
2023-12-12 13:45   ` David Hildenbrand
2023-12-04 23:49 ` [PATCH v3 4/4] mm/ksm: document ksm advisor and its sysfs knobs Stefan Roesch
2023-12-12 13:46   ` David Hildenbrand
2023-12-05 20:46 ` [PATCH v3 0/4] mm/ksm: Add ksm advisor Andrew Morton
2023-12-07 23:18   ` Stefan Roesch

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=202312062353.lBYSA7Eb-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=riel@surriel.com \
    --cc=shr@devkernel.io \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox