lkml.org 
[lkml]   [2010]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 3/3] mm: page allocator: Drain per-cpu lists after direct reclaim allocation fails
    On Sat, 4 Sep 2010 11:23:11 +0800 Wu Fengguang <fengguang.wu@intel.com> wrote:

    > > Still, given the improvements in performance from this patchset,
    > > I'd say inclusion is a no-braniner....
    >
    > In your case it's not really high memory pressure, but maybe too many
    > concurrent direct reclaimers, so that when one reclaimed some free
    > pages, others kick in and "steal" the free pages. So we need to kill
    > the second cond_resched() call (which effectively gives other tasks a
    > good chance to steal this task's vmscan fruits), and only do
    > drain_all_pages() when nothing was reclaimed (instead of allocated).

    Well... cond_resched() will only resched when this task has been
    marked for preemption. If that's happening at such a high frequency
    then Something Is Up with the scheduler, and the reported context
    switch rate will be high.

    > Dave, will you give a try of this patch? It's based on Mel's.
    >
    >
    > --- linux-next.orig/mm/page_alloc.c 2010-09-04 11:08:03.000000000 +0800
    > +++ linux-next/mm/page_alloc.c 2010-09-04 11:16:33.000000000 +0800
    > @@ -1850,6 +1850,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_m
    >
    > cond_resched();
    >
    > +retry:
    > /* We now go into synchronous reclaim */
    > cpuset_memory_pressure_bump();
    > p->flags |= PF_MEMALLOC;
    > @@ -1863,26 +1864,23 @@ __alloc_pages_direct_reclaim(gfp_t gfp_m
    > lockdep_clear_current_reclaim_state();
    > p->flags &= ~PF_MEMALLOC;
    >
    > - cond_resched();
    > -
    > - if (unlikely(!(*did_some_progress)))
    > + if (unlikely(!(*did_some_progress))) {
    > + if (!drained) {
    > + drain_all_pages();
    > + drained = true;
    > + goto retry;
    > + }
    > return NULL;
    > + }
    >
    > -retry:
    > page = get_page_from_freelist(gfp_mask, nodemask, order,
    > zonelist, high_zoneidx,
    > alloc_flags, preferred_zone,
    > migratetype);
    >
    > - /*
    > - * If an allocation failed after direct reclaim, it could be because
    > - * pages are pinned on the per-cpu lists. Drain them and try again
    > - */
    > - if (!page && !drained) {
    > - drain_all_pages();
    > - drained = true;
    > + /* someone steal our vmscan fruits? */
    > + if (!page && *did_some_progress)
    > goto retry;
    > - }

    Perhaps the fruit-stealing event is worth adding to the
    userspace-exposed vm stats somewhere. But not in /proc - somewhere
    more temporary, in debugfs.



    \
     
     \ /
      Last update: 2010-09-04 05:59    [W:3.967 / U:0.068 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site