Re: [PATCH 10/11] Direct compact when a high-order allocation fails

From: Mel Gorman
Date: Fri Mar 26 2010 - 05:40:26 EST


On Fri, Mar 26, 2010 at 10:03:08AM +0900, KAMEZAWA Hiroyuki wrote:
> On Thu, 25 Mar 2010 10:16:54 +0000
> Mel Gorman <mel@xxxxxxxxx> wrote:
>
> > On Thu, Mar 25, 2010 at 06:50:21PM +0900, KAMEZAWA Hiroyuki wrote:
> > > On Thu, 25 Mar 2010 09:48:26 +0000
> > > Mel Gorman <mel@xxxxxxxxx> wrote:
> > >
> > > > > In that case, compact_finished() can't
> > > > > find there is a free chunk and do more work. How about using a function like
> > > > > free_pcppages_bulk(zone, pcp->batch, pcp);
> > > > > to bypass pcp list and freeing pages at once ?
> > > > >
> > > >
> > > > I think you mean to drain the PCP lists while compaction is happening
> > > > but is it justified? It's potentially a lot of IPI calls just to check
> > > > if compaction can finish a little earlier. If the pages on the PCP lists
> > > > are making that much of a difference to high-order page availability, it
> > > > implies that the zone is pretty full and it's likely that compaction was
> > > > avoided and we direct reclaimed.
> > > >
> > > Ah, sorry for my short word again. I mean draining "local" pcp list because
> > > a thread which run direct-compaction freed pages. IPI is not necessary and
> > > overkill.
> > >
> >
> > Ah, I see now. There are two places that pages get freed. release_freepages()
> > at the end of compaction when it's too late for compact_finished() to be
> > helped and within migration itself. Migration frees with either
> > free_page() or more commonly put_page() with put_page() being the most
> > frequently used. As free_page() is called on failure to migrate (rare),
> > there is little help in changing it and I'd rather not modify how
> > put_page() works.
> >
> > I could add a variant of drain_local_pages() that drains just the local PCP of
> > a given zone before compact_finished() is called. The cost would be a doubling
> > of the number of times zone->lock is taken to do the drain. Is it
> > justified? It seems overkill to me to take the zone->lock just in case
> > compaction can finish a little earlier. It feels like it would be adding
> > a guaranteed cost for a potential saving.
> >
> If you want to keep code comapct, I don't ask more.
>
> I worried about that just because memory hot-unplug were suffered by pagevec
> and pcp list before using MIGRATE_ISOLATE and proper lru_add_drain().
>

What I can do to cover that situation that won't cost much is to call
drain_local_pages after compaction completes.

Thanks


--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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/