lkml.org 
[lkml]   [2012]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 -mm 3/3] mm: only defer compaction for failed order and higher
On 01/25/2012 10:41 AM, Mel Gorman wrote:

>> --- a/mm/compaction.c
>> +++ b/mm/compaction.c
>> @@ -673,9 +673,18 @@ static int __compact_pgdat(pg_data_t *pgdat, struct compact_control *cc)
>> INIT_LIST_HEAD(&cc->freepages);
>> INIT_LIST_HEAD(&cc->migratepages);
>>
>> - if (cc->order< 0 || !compaction_deferred(zone))
>> + if (cc->order< 0 || !compaction_deferred(zone, cc->order))
>> compact_zone(zone, cc);
>>
>> + if (cc->order> 0) {
>> + int ok = zone_watermark_ok(zone, cc->order,
>> + low_wmark_pages(zone), 0, 0);
>> + if (ok&& cc->order> zone->compact_order_failed)
>> + zone->compact_order_failed = cc->order + 1;
>> + else if (!ok&& cc->sync)
>> + defer_compaction(zone, cc->order);
>> + }
>> +
>
> That needs a comment. I think what you're trying to do is reset
> compat_order_failed once compaction is successful.
>
> The "!ok&& cc->sync" check may be broken. __compact_pgdat() is
> called from kswapd, not direct compaction so cc->sync will not be true.

The problem with doing that is that we would be deferring
synchronous compaction (by allocators), just because
asynchronous compaction from kswapd failed...

That is the reason the code is like it is above. And
indeed, it will not defer compaction from this code path
right now.

Then again, neither does async compaction from page
allocators defer compaction - only sync compaction does.

If it turns out we need a separate compaction deferral
for async compaction, we can always introduce that later,
and this code will be ready for it.

If you prefer, I can replace the whole "else if" bit with
a big fat comment explaining why we cannot currently
defer compaction from this point.


\
 
 \ /
  Last update: 2012-01-25 16:59    [W:0.188 / U:0.016 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site