From: Johannes Weiner <hannes@cmpxchg.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
linux-mm@kvack.org
Subject: Re: page type is 3, passed migratetype is 1 (nr=512)
Date: Wed, 29 May 2024 12:28:30 -0400 [thread overview]
Message-ID: <20240529162830.GA1049743@cmpxchg.org> (raw)
In-Reply-To: <20240528164756.GA2820@cmpxchg.org>
Thanks for the config, I was able to reproduce it with.
On Tue, May 28, 2024 at 12:48:05PM -0400, Johannes Weiner wrote:
> Ah, but there DOES seem to be an issue with how we reserve
> highatomics: reserving and unreserving happens one pageblock at a
> time, but MAX_ORDER is usually bigger. If we rmqueue() an order-10
> request, reserve_highatomic_block() will only convert the first
> order-9 block in it; the tail will remain the original type, which
> will produce a buddy of mixed type blocks upon freeing.
>
> This doesn't fully explain the warning here. We'd expect to see it the
> other way round - passing an assumed type of 3 (HIGHATOMIC) for the
> remainder that is actually 1 (MOVABLE). But the pageblock-based
> reservations look fishy. I'll cook up a patch to make this
> range-based. It might just fix it in a way I'm not seeing just yet.
tl;dr: With some debugging printks, I was able to see the
issue. Should be a straight-forward fix.
No order-10 allocations are necessary. Instead, smaller allocations
grab blocks for the highatomic pool. Unreserving is lazy, so as those
allocations get freed, they have a chance to merge together. Two
adjacent highatomic blocks can merge (MAX_ORDER > pageblock_order). On
unreserve, we now have an order-10 highatomic buddy, but only clear
the type on the first order-9 pageblock. A subsequent alloc + expand
will warn about this type inconsistency.
[ 411.188518] UNRESERVE: pfn=26000 order=10
[ 411.188739] ------------[ cut here ]------------
[ 411.188881] 26200: page type is 3, passed migratetype is 1 (nr=512)
[ 411.189097] WARNING: CPU: 1 PID: 10152 at mm/page_alloc.c:645 expand+0x1c8/0x1f0
I have a draft patch to make the highatomic reservations update all
blocks inside the range, not just the first one. I'll send it out as
soon as I have tested it properly.
Thanks
next prev parent reply other threads:[~2024-05-29 16:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 8:58 page type is 3, passed migratetype is 1 (nr=512) Christoph Hellwig
2024-05-27 13:14 ` Christoph Hellwig
2024-05-28 16:47 ` Johannes Weiner
2024-05-29 5:43 ` Christoph Hellwig
2024-05-29 16:28 ` Johannes Weiner [this message]
2024-05-30 1:04 ` Johannes Weiner
2024-05-30 1:51 ` Zi Yan
2024-05-30 3:22 ` Johannes Weiner
2024-05-30 4:06 ` [PATCH] mm: page_alloc: fix highatomic typing in multi-block buddies kernel test robot
2024-05-30 11:42 ` page type is 3, passed migratetype is 1 (nr=512) Johannes Weiner
2024-05-30 14:34 ` Zi Yan
2024-05-31 13:43 ` Vlastimil Babka
2024-05-31 5:41 ` Christoph Hellwig
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=20240529162830.GA1049743@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=hch@infradead.org \
--cc=linux-mm@kvack.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.