Messages in this thread |  | | Date | Tue, 2 Jun 2009 01:14:40 -0700 (PDT) | From | David Rientjes <> | Subject | Re: [patch 3/3 -mmotm] oom: invoke oom killer for __GFP_NOFAIL |
| |
On Tue, 2 Jun 2009, Nick Piggin wrote:
> > I would really prefer if we do as Andrew suggests. Both will fix this > > problem, so I don't see it as a different topic at all. > > Well, his patch, as it stands, is a good one. Because we do have > potential higher order GFP_NOFAIL. >
There's currently an inconsistency in the definition of __GFP_NOFAIL and its implementation. The clearly defined purpose of the flag is:
* __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller * cannot handle allocation failures.
Yet __GFP_NOFAIL allocations may fail if no progress is made via direct reclaim and order > PAGE_ALLOC_COSTLY_ORDER. That's the behavior in the git HEAD and Mel's allocator rework in mmotm.
I've been addressing this implicitly by requiring __GFP_NOFAIL to always abide by the definition: we simply can never return NULL because the caller can't handle it (and, by definition, shouldn't even be responsible for considering it).
With my patch, we kill a memory hogging task that will free some memory so the allocation will succeed (or multiple tasks if insufficient contiguous memory is available). Kernel allocations use __GFP_NOFAIL, so the fault of this memory freeing is entirely on the caller, not the page allocator.
My preference for handling this is to merge my patch (obviously :), and then hopefully deprecate __GFP_NOFAIL as much as possible although I don't suspect it could be eradicated forever.
|  |