From: Lance Yang <lance.yang@linux.dev>
To: Baolin Wang <baolin.wang@linux.alibaba.com>, Dev Jain <dev.jain@arm.com>
Cc: ziy@nvidia.com, Liam.Howlett@oracle.com, npache@redhat.com,
ryan.roberts@arm.com, baohua@kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
david@kernel.org, lorenzo.stoakes@oracle.com
Subject: Re: [PATCH] khugepaged: convert redundant check to WARN_ON
Date: Tue, 24 Feb 2026 16:45:59 +0800 [thread overview]
Message-ID: <108e41e4-cbfb-458d-b72a-1becca61327d@linux.dev> (raw)
In-Reply-To: <ea59d95b-80a3-4f67-adc5-3634016eac28@linux.alibaba.com>
On 2026/2/24 16:21, Baolin Wang wrote:
>
>
> On 2/19/26 1:48 PM, Dev Jain wrote:
>> Claim: folio_order(folio) == HPAGE_PMD_ORDER => folio->index == start.
>>
>> Proof: Both loops in hpage_collapse_scan_file and collapse_file, which
>> iterate on the xarray, have the invariant that
>> start <= folio->index < start + HPAGE_PMD_NR ... (i)
>> A folio is always naturally aligned in the pagecache, therefore
>> folio_order == HPAGE_PMD_ORDER => IS_ALIGNED(folio->index,
>> HPAGE_PMD_NR) == true ... (ii)
>> thp_vma_allowable_order -> thp_vma_suitable_order requires that the
>> virtual
>> offsets in the VMA are aligned to the order,
>> => IS_ALIGNED(start, HPAGE_PMD_NR) == true ... (iii)
>>
>> Combining (i), (ii) and (iii), the claim is proven.
>>
>> Therefore, convert this to a VM_WARN_ON.
>>
>> Signed-off-by: Dev Jain <dev.jain@arm.com>
>> ---
>
> Make sense to me. Personally, I’d like to keep this VM_WARN_ON() to
> catch unexpected behavior.
+1
Reviewed-by: Lance Yang <lance.yang@linux.dev>
prev parent reply other threads:[~2026-02-24 8:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 5:48 Dev Jain
2026-02-19 22:33 ` Andrew Morton
2026-02-23 4:40 ` Dev Jain
2026-02-24 10:51 ` David Hildenbrand (Arm)
2026-02-24 8:21 ` Baolin Wang
2026-02-24 8:45 ` Lance Yang [this message]
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=108e41e4-cbfb-458d-b72a-1becca61327d@linux.dev \
--to=lance.yang@linux.dev \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=npache@redhat.com \
--cc=ryan.roberts@arm.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