Re: mm/compact: why use low watermark to determine whether compact is finished instead of use high watermark?

From: Vlastimil Babka
Date: Fri Jul 22 2016 - 05:30:22 EST

On 07/22/2016 11:21 AM, Xishi Qiu wrote:
On 2016/7/22 17:04, Vlastimil Babka wrote:

On 07/22/2016 10:56 AM, Xishi Qiu wrote:

I find all the watermarks in mm/compaction.c are low_wmark_pages(),
so why not use high watermark to determine whether compact is finished?

Why would you use high watermark? Quite the opposite, I want to move towards min watermark (precisely, the one in alloc_flags which is usually min) in this series:


this is fast path, use use low_wmark_pages() in __zone_watermark_ok()

this is slow path, usually use min_wmark_pages()

Yes, and compaction should be finished when allocation can succeed, so match __alloc_pages_slowpath().

Sounds reasonable, but now we have kcompactd which called from kswapd,
so still use low wmark?

kswapd uses high watermark (order-0) to make a buffer of free pages for both direct allocators and kcompactd. kcompactd will use min watermark for now. There used to be difference between min/low/high watermarks when checking high-orders, but now watermark only affects the check if there's enough total base pages, and high-order check then succeeds if there's at least one high(er)-order page.

Xishi Qiu

use high_wmark_pages() to determine whether zone is balanced

Xishi Qiu