Re: OOM behavior in constrained memory situations

From: Andi Kleen
Date: Tue Feb 07 2006 - 04:38:40 EST


On Tuesday 07 February 2006 02:55, Christoph Lameter wrote:
> I just tried to oom a process that has restricted its mem allocation to
> node 0 using a memory policy. Instead of an OOM the system began to swap
> on node zero. The swapping is restricted to the zones passed to
> __alloc_pages. It was thus swapping node zero alone.

Thanks for doing that work. It's needed imho and was on my todo list.


> switch (pol->policy) {
> case MPOL_DEFAULT:
> break;
> Index: linux-2.6.16-rc2/include/linux/mempolicy.h
> ===================================================================
> --- linux-2.6.16-rc2.orig/include/linux/mempolicy.h 2006-02-02 22:03:08.000000000 -0800
> +++ linux-2.6.16-rc2/include/linux/mempolicy.h 2006-02-06 17:07:41.000000000 -0800
> @@ -62,6 +62,7 @@ struct vm_area_struct;
> struct mempolicy {
> atomic_t refcnt;
> short policy; /* See MPOL_* above */
> + gfp_t gfp_flags; /* flags ORed into gfp_flags for each allocation */

I don't think it's a good idea to add it to the struct mempolicy. I've tried to
make it as memory efficient as possibile and it would be a waste to add such
a mostly unused field. Better to pass that information around in some other way.

(in the worst case it could be a upper bit in policy, but I would prefer
function arguments I think)

The rest looks good.

-Andi

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