From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Alistair Popple <apopple@nvidia.com>, Zenghui Yu <zenghui.yu@linux.dev>
Cc: Zenghui Yu <yuzenghui@huawei.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org, jgg@ziepe.ca,
leon@kernel.org, Andrew Morton <akpm@linux-foundation.org>,
ljs@kernel.org, liam@infradead.org, vbabka@kernel.org,
rppt@kernel.org, surenb@google.com, mhocko@suse.com
Subject: Re: "alloc_tag was not set" when running mm/ksft_hmm.sh
Date: Tue, 12 May 2026 08:47:49 +0200 [thread overview]
Message-ID: <f7895374-b43f-4ce7-8a26-112ad30c9273@kernel.org> (raw)
In-Reply-To: <agJ9762r0HwKSsb7@nvdebian.thelocal>
On 5/12/26 03:28, Alistair Popple wrote:
> On 2026-05-12 at 02:38 +1000, Zenghui Yu <zenghui.yu@linux.dev> wrote...
>> Hi David,
>>
>> On 5/11/26 8:47 PM, David Hildenbrand (Arm) wrote:
>
> Thanks. I have reproduced it now that my fingers are skinnier.
>
>>>
>>>
>>> zone_device_private_split_cb(), that ends up calling ->folio_split().
>>>
>>> We do have a call to pgalloc_tag_split() in __split_unmapped_folio(), invoked in
>>> __folio_freeze_and_split_unmapped() before calling
>>> zone_device_private_split_cb() when iterating the folios.
>>
>> If I read the code correctly, pgalloc_tag_split() in
>> __split_unmapped_folio() deals with device private pages' alloc tag. But
>> what alloc_tag_sub_check() warns on are real system memory pages (device
>> page's backing page), which are allocated by
>> dmirror_devmem_alloc_page()/folio_page().
>>
>> static void dmirror_devmem_folio_split(struct folio *head, struct folio
>> *tail)
>> {
>> struct page *rpage = BACKING_PAGE(folio_page(head, 0));
>>
>> Thanks,
>> Zenghui
>>
>>> The zone_device_private_split_cb(folio, NULL); is then called on the first folio
>>> after looping over the other (new) folios.
>>>
>>> I would assume that __folio_freeze_and_split_unmapped() would already do the
>>> right thing?
>
> Well you know what they say about assumptions :) Although in this case
> __folio_freeze_and_split_unmapped() isn't called on the backing page anyway
> (it's called to split the ZONE_DEVICE page, not the page simulating device
> memory).
Now my brain hurts :)
> The problem is we're not splitting the tag associated with the backing
> page for the simulated memory.
>
> I came up with the below fix last night, but I suspect it will quite reasonably
> get NACKED on the basis of the symbol export so was looking at other solutions.
I think there are other problems ...
>
> The simulated memory should just be used like a bare physical address range. So
> there really is no reason for the backing page simulating device memory to be
> allocated as a higher order folio. Using the struct page to store some metadata
> for the simulated device is convenient though to avoid creating a test-specific
> data structure for this. So I am looking at going back to allocating the
> simulated backing memory as always order-0 pages in the test which is what it
> was prior to the introduction of large device pages, but that was causing a
> crash I'm yet to debug.
>
... such as doing a folio_page(folio_alloc()), followed by a __free_pages().
Why are we even allocating folios here and manually splitting them?
Looking at dmirror_devmem_folio_split(), aren't we using folios here for
something that ... is not a folio?
Likely we really shouldn't be using folios here ... :)
--
Cheers,
David
next prev parent reply other threads:[~2026-05-12 6:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 15:42 "alloc_tag was not set" when running mm/ksft_hmm.sh Zenghui Yu
2026-05-08 11:53 ` David Hildenbrand (Arm)
2026-05-08 16:35 ` Alistair Popple
2026-05-11 12:19 ` Zenghui Yu
2026-05-11 12:47 ` David Hildenbrand (Arm)
2026-05-11 16:38 ` Zenghui Yu
2026-05-12 1:05 ` Zenghui Yu
2026-05-12 6:40 ` Alistair Popple
2026-05-12 1:28 ` Alistair Popple
2026-05-12 6:47 ` David Hildenbrand (Arm) [this message]
2026-05-12 7:46 ` Alistair Popple
2026-05-12 7:51 ` David Hildenbrand (Arm)
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=f7895374-b43f-4ce7-8a26-112ad30c9273@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=yuzenghui@huawei.com \
--cc=zenghui.yu@linux.dev \
/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