Re: [patch 4/7] fault-injection capability for alloc_pages()

Andrew Morton
2006-10-12T21:40:54Z

On Thu, 12 Oct 2006 16:43:09 +0900
Akinobu Mita <akinobu.mita@gmail.com> wrote:

> @@ -1058,6 +1097,9 @@ __alloc_pages(gfp_t gfp_mask, unsigned i
>
> might_sleep_if(wait);
>
> + if (should_fail_alloc_page(gfp_mask, order))
> + return NULL;

In previous work I've done on this I've found that allowing
application-initiated allocations to fail is a right pain: all of userspace
gets all unreliable and applications die all the time.

I realise that it's possible to limit the failures to a particular process,
but it's also possible to let the allocations fail for _all_ processes, in
which case this problem will hurt.

What I found was a reasonable fix for this problem was to limit the
failures to those requests which did not have __GFP_HIGHMEM set. That way,
userspace allocations work, but kernel-internal allocations are subject to
failures.

That might be worth adding as an additional tunable?