Re: [PATCH] 2.6.5-aa1 arch updates

From: Andrew Morton
Date: Sun Apr 04 2004 - 17:13:31 EST


Andrew Morton <akpm@xxxxxxxx> wrote:
>
> Hugh Dickins <hugh@xxxxxxxxxxx> wrote:
> >
> > I notice that's a __GFP_REPEAT allocation, but even those fail when
> > OOM-killed - I find its alias __GFP_NOFAIL very misleading.
>
> #define __GFP_REPEAT 0x400 /* Retry the allocation. Might fail */
> #define __GFP_NOFAIL 0x800 /* Retry for ever. Cannot fail */
>
> __GFP_REPEAT is mainly for higher-order allocations which would otherwise
> have given up too early.

It all comes back to me now. The reason there is a __GFP_REPEAT in the
pte_alloc_one() implementations is that lots of architectures used to do
stuff like this:

static inline pte_t *
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
{
int count = 0;
pte_t *pte;

do {
pte = (pte_t *)__get_free_page(GFP_KERNEL);
if (pte)
clear_page(pte);
else {
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(HZ);
}
} while (!pte && (count++ < 10));

return pte;
}

That was all removed and the __GFP_REPEAT flag was added instead, as a "try
really hard" hint to the page allocator.

-
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/