[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3f454aa-7cff-4e85-b046-5d4c55d8ccb9@kernel.org>
Date: Thu, 5 Feb 2026 14:58:56 +0100
From: "David Hildenbrand (Arm)" <david@...nel.org>
To: Kiryl Shutsemau <kas@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Muchun Song <muchun.song@...ux.dev>, Matthew Wilcox <willy@...radead.org>,
Usama Arif <usamaarif642@...il.com>, Frank van der Linden <fvdl@...gle.com>
Cc: Oscar Salvador <osalvador@...e.de>, Mike Rapoport <rppt@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Zi Yan <ziy@...dia.com>,
Baoquan He <bhe@...hat.com>, Michal Hocko <mhocko@...e.com>,
Johannes Weiner <hannes@...xchg.org>, Jonathan Corbet <corbet@....net>,
Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui <kernel@...0n.name>,
Palmer Dabbelt <palmer@...belt.com>, Paul Walmsley
<paul.walmsley@...ive.com>, Albert Ou <aou@...s.berkeley.edu>,
Alexandre Ghiti <alex@...ti.fr>, kernel-team@...a.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
loongarch@...ts.linux.dev, linux-riscv@...ts.infradead.org
Subject: Re: [PATCHv6 09/17] mm/sparse: Check memmap alignment for
compound_info_has_mask()
On 2/5/26 14:31, David Hildenbrand (Arm) wrote:
> On 2/2/26 16:56, Kiryl Shutsemau wrote:
>> If page->compound_info encodes a mask, it is expected that vmemmap to be
>> naturally aligned to the maximum folio size.
>>
>> Add a VM_BUG_ON() to check the alignment.
>>
>> Signed-off-by: Kiryl Shutsemau <kas@...nel.org>
>> Acked-by: Zi Yan <ziy@...dia.com>
>> ---
>> mm/sparse.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/mm/sparse.c b/mm/sparse.c
>> index b5b2b6f7041b..6c9b62607f3f 100644
>> --- a/mm/sparse.c
>> +++ b/mm/sparse.c
>> @@ -600,6 +600,13 @@ void __init sparse_init(void)
>> BUILD_BUG_ON(!is_power_of_2(sizeof(struct mem_section)));
>> memblocks_present();
>> + if (compound_info_has_mask()) {
>> + unsigned long alignment;
>> +
>> + alignment = MAX_FOLIO_NR_PAGES * sizeof(struct page);
>> + VM_BUG_ON(!IS_ALIGNED((unsigned long) pfn_to_page(0),
>> alignment));
>
> No VM_BUG_ON. VM_WARN_ON_ONCE() should be good enough, no?
>
> As discussed in the other thread, is checking for MAX_FOLIO_NR_PAGES
> alignment sufficient?
And after further discussions, we could use MAX_FOLIO_VMEMMAP_ALIGN
macro once we have that.
--
Cheers,
David
Powered by blists - more mailing lists