• Nick Piggin's avatar
    [PATCH] mempool: simplify alloc · 20a77776
    Nick Piggin authored
    Mempool is pretty clever.  Looks too clever for its own good :) It
    shouldn't really know so much about page reclaim internals.
    - don't guess about what effective page reclaim might involve.
    - don't randomly flush out all dirty data if some unlikely thing
      happens (alloc returns NULL). page reclaim can (sort of :P) handle
    I think the main motivation is trying to avoid pool->lock at all costs.
    However the first allocation is attempted with __GFP_WAIT cleared, so it
    will be 'can_try_harder' if it hits the page allocator.  So if allocation
    still fails, then we can probably afford to hit the pool->lock - and what's
    the alternative?  Try page reclaim and hit zone->lru_lock?
    A nice upshot is that we don't need to do any fancy memory barriers or do
    (intentionally) racy access to pool-> fields outside the lock.
    Signed-off-by: default avatarNick Piggin <nickpiggin@yahoo.com.au>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>