lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c6d755ba-e888-4d13-b9e6-c991fbeb31d4@intel.com>
Date: Thu, 15 Jan 2026 20:13:35 +0800
From: "Chen, Yu C" <yu.c.chen@...el.com>
To: Jianyong Wu <jianyong.wu@...look.com>, Tim Chen
	<tim.c.chen@...ux.intel.com>
CC: Juri Lelli <juri.lelli@...hat.com>, Dietmar Eggemann
	<dietmar.eggemann@....com>, Steven Rostedt <rostedt@...dmis.org>, Ben Segall
	<bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>, Valentin Schneider
	<vschneid@...hat.com>, Madadi Vineeth Reddy <vineethr@...ux.ibm.com>, "Hillf
 Danton" <hdanton@...a.com>, Shrikanth Hegde <sshegde@...ux.ibm.com>, "Yangyu
 Chen" <cyy@...self.name>, Tingyin Duan <tingyin.duan@...il.com>, Vern Hao
	<vernhao@...cent.com>, Vern Hao <haoxing990@...il.com>, Len Brown
	<len.brown@...el.com>, Aubrey Li <aubrey.li@...el.com>, Zhao Liu
	<zhao1.liu@...el.com>, Chen Yu <yu.chen.surf@...il.com>, Adam Li
	<adamli@...amperecomputing.com>, Aaron Lu <ziqianlu@...edance.com>, Tim Chen
	<tim.c.chen@...el.com>, <linux-kernel@...r.kernel.org>, Peter Zijlstra
	<peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, K Prateek Nayak
	<kprateek.nayak@....com>, "Gautham R . Shenoy" <gautham.shenoy@....com>,
	Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH v2 20/23] sched/cache: Add user control to adjust the
 parameters of cache-aware scheduling

Hello Jianyong,

On 1/15/2026 6:03 PM, Jianyong Wu wrote:
> Hello Tim, Chen Yu,
> 
>>
>>   static bool exceed_llc_capacity(struct mm_struct *mm, int cpu)
>>   {
>> +    unsigned int llc, scale;
>>       struct cacheinfo *ci;
>>       unsigned long rss;
>> -    unsigned int llc;
>>       /*
>>        * get_cpu_cacheinfo_level() can not be used
>> @@ -1252,19 +1266,54 @@ static bool exceed_llc_capacity(struct 
>> mm_struct *mm, int cpu)
>>       rss = get_mm_counter(mm, MM_ANONPAGES) +
>>           get_mm_counter(mm, MM_SHMEMPAGES);
>> -    return (llc <= (rss * PAGE_SIZE));
>> +    /*
>> +     * Scale the LLC size by 256*llc_aggr_tolerance
>> +     * and compare it to the task's RSS size.
>> +     *
>> +     * Suppose the L3 size is 32MB. If the
>> +     * llc_aggr_tolerance is 1:
>> +     * When the RSS is larger than 32MB, the process
>> +     * is regarded as exceeding the LLC capacity. If
>> +     * the llc_aggr_tolerance is 99:
>> +     * When the RSS is larger than 784GB, the process
>> +     * is regarded as exceeding the LLC capacity because:
>> +     * 784GB = (1 + (99 - 1) * 256) * 32MB
>> +     */
>> +    scale = get_sched_cache_scale(256);
>> +    if (scale == INT_MAX)
>> +        return false;
>> +
>> +    return ((llc * scale) <= (rss * PAGE_SIZE));
>>   }
> Suppose the LLC is 16 MB (which is 16777216 bytes). If we set 
> `llc_aggr_tolerance` to 99, the `scale` value will be 25089. When 
> calculating `16777216 * 25089`, the result is 420923572224, which 
> exceeds 2^32 and thus causes an integer overflow.
>

[resend might be due to smtp issue]
Good catch! Let me switch it to u64, it should be big enough for
llc size(max to about (2^64 -1)/2589 bytes)

thanks,
Chenyu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ