Skip to contentSkip to conversation

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

DISCUSSION Xishi Qiu 2 participants 4 messages Jul 22, 2016 Memory management

lore
Share & tools
lore

Xishi Qiu

author
#0 lore raw

Hi,

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?

e.g.
__alloc_pages_nodemask()
get_page_from_freelist()
this is fast path, use use low_wmark_pages() in __zone_watermark_ok()

__alloc_pages_slowpath()
this is slow path, usually use min_wmark_pages()

kswapd
balance_pgdat()
use high_wmark_pages() to determine whether zone is balanced

Thanks,
Xishi Qiu

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 4 lines · Xishi Qiu

Hi,

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:

https://lkml.org/lkml/2016/6/24/222

especially:

https://lkml.org/lkml/2016/6/24/214

Quoted 7 lines

e.g.
__alloc_pages_nodemask()
get_page_from_freelist()
this is fast path, use use low_wmark_pages() in __zone_watermark_ok()

__alloc_pages_slowpath()
this is slow path, usually use min_wmark_pages()

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

Quoted 8 lines

kswapd
balance_pgdat()
use high_wmark_pages() to determine whether zone is balanced

Thanks,
Xishi Qiu

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#2 lore raw
Quoted 19 lines · Vlastimil Babka
Quoted 4 lines · Xishi Qiu

Hi,

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:

https://lkml.org/lkml/2016/6/24/222

especially:

https://lkml.org/lkml/2016/6/24/214

Quoted 5 lines

e.g.
__alloc_pages_nodemask()
get_page_from_freelist()
this is fast path, use use low_wmark_pages() in __zone_watermark_ok()

Quoted 5 lines
Quoted 2 lines

__alloc_pages_slowpath()
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?

Thanks,
Xishi Qiu

Quoted 5 lines
Quoted 5 lines

kswapd
balance_pgdat()
use high_wmark_pages() to determine whether zone is balanced

Quoted 7 lines
Quoted 3 lines

Thanks,
Xishi Qiu

.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 21 lines · Xishi Qiu
Quoted 19 lines · Vlastimil Babka
Quoted 4 lines · Xishi Qiu

Hi,

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:

https://lkml.org/lkml/2016/6/24/222

especially:

https://lkml.org/lkml/2016/6/24/214

Quoted 5 lines

e.g.
__alloc_pages_nodemask()
get_page_from_freelist()
this is fast path, use use low_wmark_pages() in __zone_watermark_ok()

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

__alloc_pages_slowpath()
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.

Quoted 18 lines

Thanks,
Xishi Qiu

Quoted 12 lines
Quoted 8 lines

kswapd
balance_pgdat()
use high_wmark_pages() to determine whether zone is balanced

Thanks,
Xishi Qiu

.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>