Re: [RFC PATCH 4/4] mm: adjust free_pages to make __zone_watermark_ok() mTHP-aware

From: Bo Zhang

Date: Thu Sep 03 2026 - 11:50:02 EST


On Thu, Sep 03, 2026 at 10:46:03AM +0800, Xueyuan Chen wrote:
> >+ free_pages = zone_effective_free_pages(zone, order,
> >+ defrag_mode & order);
>
> "&" should be "&&". defrag_mode is 0 or 1, so this is just order & 1:
> works for order-3 by accident, always 0 for order-2.
>
> Same for the zone_page_state_snapshot() call below.

Good catch, thanks. You're right - this should be a logical "&&".
The bitwise "&" accidentally disables the block accounting for even
orders like order-2, which is exactly the mTHP case this series targets.

I'll fix both occurrences in v2.

Thanks,
Bo