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: <201002032355.01260.l.lunak@suse.cz>
Date:	Wed, 3 Feb 2010 23:55:01 +0100
From:	Lubos Lunak <l.lunak@...e.cz>
To:	David Rientjes <rientjes@...gle.com>
Cc:	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	Rik van Riel <riel@...hat.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Nick Piggin <npiggin@...e.de>, Jiri Kosina <jkosina@...e.cz>
Subject: Re: Improving OOM killer

On Wednesday 03 of February 2010, David Rientjes wrote:
> My rewrite for the badness() heuristic is centered on the idea that scores
> should range from 0 to 1000, 0 meaning "never kill this task" and 1000
> meaning "kill this task first."  The baseline for a thread, p, may be
> something like this:
>
> 	unsigned int badness(struct task_struct *p,
> 					unsigned long totalram)
> 	{
> 		struct task_struct *child;
> 		struct mm_struct *mm;
> 		int forkcount = 0;
> 		long points;
>
> 		task_lock(p);
> 		mm = p->mm;
> 		if (!mm) {
> 			task_unlock(p);
> 			return 0;
> 		}
> 		points = (get_mm_rss(mm) +
> 				get_mm_counter(mm, MM_SWAPENTS)) * 1000 /
> 				totalram;
> 		task_unlock(p);
>
> 		list_for_each_entry(child, &p->children, sibling)
> 			/* No lock, child->mm won't be dereferenced */
> 			if (child->mm && child->mm != mm)
> 				forkcount++;
>
> 		/* Forkbombs get penalized 10% of available RAM */
> 		if (forkcount > 500)
> 			points += 100;

 As far as I'm concerned, this is a huge improvement over the current code 
(and, incidentally :), quite close to what I originally wanted). I'd be 
willing to test it in few real-world desktop cases if you provide a patch.

> 		/*
> 		 * /proc/pid/oom_adj ranges from -1000 to +1000 to either
> 		 * completely disable oom killing or always prefer it.
> 		 */
> 		points += p->signal->oom_adj;

 This changes semantics of oom_adj, but given that I expect the above to make 
oom_adj unnecessary on the desktop for the normal cases, I don't really mind.

-- 
 Lubos Lunak
 openSUSE Boosters team, KDE developer
 l.lunak@...e.cz , l.lunak@....org
--
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