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]
Date:	Tue, 24 May 2011 10:14:17 +0900
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	minchan.kim@...il.com
CC:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org, caiqian@...hat.com, rientjes@...gle.com,
	hughd@...gle.com, kamezawa.hiroyu@...fujitsu.com, oleg@...hat.com
Subject: Re: [PATCH 3/5] oom: oom-killer don't use proportion of system-ram
 internally

Hi


>> @@ -476,14 +476,17 @@ static const struct file_operations proc_lstats_operations = {
>>
>>   static int proc_oom_score(struct task_struct *task, char *buffer)
>>   {
>> -       unsigned long points = 0;
>> +       unsigned long points;
>> +       unsigned long ratio = 0;
>> +       unsigned long totalpages = totalram_pages + total_swap_pages + 1;
>
> Does we need +1?
> oom_badness does have the check.

"ratio = points * 1000 / totalpages;" need to avoid zero divide.

>>         /*
>>          * Root processes get 3% bonus, just like the __vm_enough_memory()
>>          * implementation used by LSMs.
>> +        *
>> +        * XXX: Too large bonus, example, if the system have tera-bytes memory..
>>          */
>> -       if (has_capability_noaudit(p, CAP_SYS_ADMIN))
>> -               points -= 30;
>> +       if (has_capability_noaudit(p, CAP_SYS_ADMIN)) {
>> +               if (points>= totalpages / 32)
>> +                       points -= totalpages / 32;
>> +               else
>> +                       points = 0;
>
> Odd. Why do we initialize points with 0?
>
> I think the idea is good.

The points is unsigned. It's common technique to avoid underflow.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ