public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	linux-kernel@vger.kernel.org, linux-mm@vger.kernel.org,
	Michal Nazarewicz <mina86@mina86.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Christoph Lameter <cl@linux.com>, Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@suse.de>, Minchan Kim <minchan@kernel.org>,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Subject: Re: [PATCH v5 02/14] mm, compaction: defer each zone individually instead of preferred zone
Date: Fri, 01 Aug 2014 10:51:07 +0200	[thread overview]
Message-ID: <53DB54FB.6050100@suse.cz> (raw)
In-Reply-To: <53D91BC9.7080506@suse.cz>

On 07/30/2014 06:22 PM, Vlastimil Babka wrote:
> On 07/29/2014 11:12 AM, Vlastimil Babka wrote:
>> On 07/29/2014 08:38 AM, Joonsoo Kim wrote:
>>>
>>> I still don't understand why defer_compaction() is needed here.
>>> defer_compaction() is intended for not struggling doing compaction on
>>> the zone where we already have tried compaction and found that it
>>> isn't suitable for compaction. Allocation failure doesn't tell us
>>> that we have tried compaction for all the zone range so we shouldn't
>>> make a decision here to defer compaction on this zone carelessly.
>>
>> OK I can remove that, it should make the code nicer anyway.
>
> Weird, that removal of this defer_compaction() call seems ho have
> quadrupled compact_stall and compact_fail counts. The scanner pages
> counters however increased by only 10% so that could indicate the
> problem is occuring only in a small zone such as DMA. Could be another
> case of mismatch between watermark checking in compaction and
> allocation? Perhaps the lack of proper classzone_idx in the compaction
> check? Sigh.

Yep so it was the DMA zone returning COMPACT_PARTIAL from the 
compaction_suitable() check done at the very beginning of 
compact_zone(). The meaning of that is "the allocation should succeed 
without compaction", so compaction is not done at all. Yet the 
COMPACT_PARTIAL return value means it counts as a stall, even with the 
patch that doesn't count COMPACT_SKIPPED as stalls.
The watermark check in try_to_compact_pages() also apparently succeeds 
as the compaction is not being deferred. With deferral removed from 
__alloc_pages_direct_compact(), this zone will be attempted uselessly 
each time, and deferred_compaction is practically never reported back.

So for now I think it would be best to leave the defer_compaction() call 
in __alloc_pages_direct_compact() as it is. Fixing this in a better way 
would require more investigation (I guess the lack of classzone_idx in 
compaction makes the difference for the watermark checks here) and 
another patch(es), which I'll attempt, but I don't want to further grow 
this series with new patches right now.

>> I also agree
>> with the argument "for all the zone range" and I also realized that it's
>> not (both before and after this patch) really the case. I planned to fix
>> that in the future, but I can probably do it now.
>> The plan is to call defer_compaction() only when compaction returned
>> COMPACT_COMPLETE (and not COMPACT_PARTIAL) as it means the whole zone
>> was scanned. Otherwise there will be bias towards the beginning of the
>> zone in the migration scanner - compaction will be deferred half-way and
>> then cached pfn's might be reset when it restarts, and the rest of the
>> zone won't be scanned at all.
>
> Hm despite expectations, this didn't seem to make much difference. But
> maybe there will be once I have some idea what happened to those stalls.

Yeah, so it doesn't matter here if I call defer_compaction() with only 
COMPACT_COMPLETE returned from compact_zone(). The whole thing is only 
done when watermarks check fails, and it doesn't for the DMA zone.

>>> Thanks.
>>>
>>
>


  reply	other threads:[~2014-08-01  8:51 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28 13:11 [PATCH v5 00/14] compaction: balancing overhead and success rates Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 01/14] mm, THP: don't hold mmap_sem in khugepaged when allocating THP Vlastimil Babka
2014-07-28 23:39   ` David Rientjes
2014-07-28 13:11 ` [PATCH v5 02/14] mm, compaction: defer each zone individually instead of preferred zone Vlastimil Babka
2014-07-28 23:59   ` David Rientjes
2014-07-29  9:02     ` Vlastimil Babka
2014-07-29  6:38   ` Joonsoo Kim
2014-07-29  9:12     ` Vlastimil Babka
2014-07-30 16:22       ` Vlastimil Babka
2014-08-01  8:51         ` Vlastimil Babka [this message]
2014-08-04  6:45           ` Joonsoo Kim
2014-07-28 13:11 ` [PATCH v5 03/14] mm, compaction: do not count compact_stall if all zones skipped compaction Vlastimil Babka
2014-07-29  0:04   ` David Rientjes
2014-07-28 13:11 ` [PATCH v5 04/14] mm, compaction: do not recheck suitable_migration_target under lock Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 05/14] mm, compaction: move pageblock checks up from isolate_migratepages_range() Vlastimil Babka
2014-07-29  0:29   ` David Rientjes
2014-07-29  9:27     ` Vlastimil Babka
2014-07-29 23:02       ` David Rientjes
2014-07-29 23:21         ` Kirill A. Shutemov
2014-07-29 23:51           ` David Rientjes
2014-07-30  9:27             ` Vlastimil Babka
2014-07-30  9:39         ` Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 06/14] mm, compaction: reduce zone checking frequency in the migration scanner Vlastimil Babka
2014-07-29  0:44   ` David Rientjes
2014-07-29  9:31     ` Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 07/14] mm, compaction: khugepaged should not give up due to need_resched() Vlastimil Babka
2014-07-29  0:59   ` David Rientjes
2014-07-29  9:45     ` Vlastimil Babka
2014-07-29 22:57       ` David Rientjes
2014-07-29  6:53   ` Joonsoo Kim
2014-07-29  7:31     ` David Rientjes
2014-07-29  8:27       ` Joonsoo Kim
2014-07-29  9:16         ` David Rientjes
2014-07-29  9:49       ` Vlastimil Babka
2014-07-29 22:53         ` David Rientjes
2014-07-30  9:08           ` Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 08/14] mm, compaction: periodically drop lock and restore IRQs in scanners Vlastimil Babka
2014-07-29  1:03   ` David Rientjes
2014-07-28 13:11 ` [PATCH v5 09/14] mm, compaction: skip rechecks when lock was already held Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 10/14] mm, compaction: remember position within pageblock in free pages scanner Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 11/14] mm, compaction: skip buddy pages by their order in the migrate scanner Vlastimil Babka
2014-07-29  1:05   ` David Rientjes
2014-07-28 13:11 ` [PATCH v5 12/14] mm: rename allocflags_to_migratetype for clarity Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 13/14] mm, compaction: pass gfp mask to compact_control Vlastimil Babka
2014-07-28 13:11 ` [PATCH v5 14/14] mm, compaction: try to capture the just-created high-order freepage Vlastimil Babka
2014-07-29  7:34   ` Joonsoo Kim
2014-07-29 15:34     ` Vlastimil Babka
2014-07-30  8:39       ` Joonsoo Kim
2014-07-30  9:56         ` Vlastimil Babka
2014-07-30 14:19           ` Joonsoo Kim
2014-07-30 15:05             ` Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53DB54FB.6050100@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mina86@mina86.com \
    --cc=minchan@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=zhangyanfei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox