Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	David Hildenbrand <david@kernel.org>,
	 Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	 Brendan Jackman <brendan.jackman@linux.dev>,
	Zi Yan <ziy@nvidia.com>, Lorenzo Stoakes <ljs@kernel.org>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Mike Rapoport <rppt@kernel.org>, Qi Zheng <qi.zheng@linux.dev>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	Kairui Song <kasong@tencent.com>, Barry Song <baohua@kernel.org>,
	 Axel Rasmussen <axelrasmussen@google.com>,
	Yuanchu Xie <yuanchu@google.com>, Wei Xu <weixugc@google.com>,
	 Baoquan He <baoquan.he@linux.dev>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	 Dev Jain <dev.jain@arm.com>, Harry Yoo <harry@kernel.org>,
	Usama Arif <usama.arif@linux.dev>,
	 linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH v2 1/3] mm: page_alloc: add a watermark check that knows the migratetype
Date: Mon, 16 Nov 2026 10:41:09 +0000	[thread overview]
Message-ID: <avrVAUGFUJdoVRG7@shutemov.name> (raw)
In-Reply-To: <7e82bf2d-3a36-46d4-b63e-6b6720620380@kernel.org>

On Fri, Nov 13, 2026 at 05:51:52PM +0100, Vlastimil Babka (SUSE) wrote:
> On 11/2/26 10:39, Kiryl Shutsemau (Meta) wrote:
> > The high-order check in __zone_watermark_ok() accepts a free page of any
> > migratetype.  Under ALLOC_NOFRAGMENT, a request below pageblock_order can
> > only take a page of its own migratetype or claim a whole free block, so
> > the check can pass when the allocation cannot succeed.
> > 
> > Telling those apart needs the request's migratetype, but not every check
> > wants them told apart.  A check whether an allocation can be served now
> > has to count only the pages it can take.
> > 
> > A check whether there is enough free memory counts every migratetype:
> > kswapd and kcompactd balancing a zone, order-0 thresholds, the
> > slowpath's forecast whether reclaim and compaction can still make
> > progress.  Reclaim and compaction work across migratetypes to free whole
> > pageblocks.
> > 
> > Move the body of __zone_watermark_ok() into __zone_watermark_ok_mt(),
> > which takes the migratetype as well, and make __zone_watermark_ok() a
> > wrapper around it for the second kind of check.  These use the new
> > function:
> > 
> >   - the allocator fast path, zone_watermark_fast();
> >   - its recheck after node reclaim in get_page_from_freelist();
> >   - compaction's up-front check, compaction_suit_allocation_order().
> > 
> > Declare both in mm/internal.h: nothing outside mm uses them.
> 
> Why not mm/page_alloc.h instead, now that it exists.

Ack. Will change.

> > @@ -3665,6 +3666,21 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
> >  	return false;
> >  }
> >  
> > +/*
> > + * For checks that are not about serving one allocation now: kswapd and
> > + * kcompactd balancing a zone, order-0 thresholds, forecasts whether
> > + * reclaim and compaction can still make progress.  They count free pages
> > + * of every migratetype: reclaim and compaction work across migratetypes
> > + * to free whole pageblocks.
> > + */
> 
> What a slop comment, sigh. Can you rewrite it normally?

/*
 * Return true if free base pages in the zone are above 'mark' regardless
 * of migratetype. Use it to check whether the zone as a whole has enough
 * free memory. Use __zone_watermark_ok_mt() instead to check whether a
 * particular allocation can be served.
 */

Okay?

-- 
  Kiryl Shutsemau / Kirill A. Shutemov


  reply	other threads:[~2026-11-16 10:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  9:39 [PATCH v2 0/3] mm: make watermark checks honour ALLOC_NOFRAGMENT Kiryl Shutsemau (Meta)
2026-11-02  9:39 ` [PATCH v2 1/3] mm: page_alloc: add a watermark check that knows the migratetype Kiryl Shutsemau (Meta)
2026-11-05 17:06   ` Harry Yoo
2026-11-11 19:49     ` Kiryl Shutsemau
2026-11-13 17:03       ` Vlastimil Babka (SUSE)
2026-11-16 10:52         ` Kiryl Shutsemau (Meta)
2026-11-13 16:51   ` Vlastimil Babka (SUSE)
2026-11-16 10:41     ` Kiryl Shutsemau (Meta) [this message]
2026-11-16 10:55       ` Vlastimil Babka (SUSE)
2026-11-02  9:39 ` [PATCH v2 2/3] mm: page_alloc: make the high-order watermark check honour ALLOC_NOFRAGMENT Kiryl Shutsemau (Meta)
2026-11-13 17:48   ` Vlastimil Babka (SUSE)
2026-11-02  9:39 ` [PATCH v2 3/3] mm: vmscan: tell direct reclaim the allocation is ALLOC_NOFRAGMENT Kiryl Shutsemau (Meta)
2026-11-13 17:58   ` Vlastimil Babka (SUSE)

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=avrVAUGFUJdoVRG7@shutemov.name \
    --to=kas@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=baoquan.he@linux.dev \
    --cc=brendan.jackman@linux.dev \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=harry@kernel.org \
    --cc=kasong@tencent.com \
    --cc=kernel-team@meta.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=qi.zheng@linux.dev \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=yuanchu@google.com \
    --cc=ziy@nvidia.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