Re: [patch 05/10 -mm v3] oom: badness heuristic rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 10 Mar 2010 02:41:32 -0800 (PST)
David Rientjes <rientjes@xxxxxxxxxx> wrote:

>  	if (sysctl_panic_on_oom == 2)
>  		panic("out of memory(memcg). panic_on_oom is selected.\n");
> +
> +	limit = mem_cgroup_get_limit(mem) >> PAGE_SHIFT;

A small concern here.

+u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)
+{
+       return res_counter_read_u64(&memcg->memsw, RES_LIMIT);
+}

Because memory cgroup has 2 limit controls as "memory" and "memory+swap",
a user may set only "memory" limitation. (Especially on swapless system.)
Then, memcg->memsw limit can be infinite in some situation.

So, how about this ? (just an idea after breif thinking..)

u64 mem_cgroup_get_memsw_limit(struct mem_cgroup *memcg)
{
	u64 memlimit, memswlimit;

	memlimit = res_counter_read_u64(&memcg->res, RES_LIMIT);
	memswlimit = res_counter_read_u64(&memcg->memsw, RES_LIMIT);
	if (memlimit + total_swap_pages > memswlimit)
		return memswlimit;
	return memlimit + total_swap_pages;
}

Thanks,
-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]