Re: [PATCH] mm/migrate_device: Cleanup up PMD Checks and warnings

From: SeongJae Park

Date: Thu Apr 16 2026 - 19:52:04 EST


On Tue, 14 Apr 2026 19:43:38 +0530 Sunny Patel <nueralspacetech@xxxxxxxxx> wrote:

> Remove the odd VM_WARN_ON_FOLIO(!folio, folio) usage and replace it
> with a simpler VM_WARN_ON_ONCE(!folio) check.
>
> Drop the redundant VM_WARN_ON_ONCE(!pmd_none(*pmdp) &&
> !is_huge_zero_pmd(*pmdp)).
>
> Refactor the PMD checks to use pmd_present(), making the control flow
> clearer and avoiding duplicate condition checks.
>
> Signed-off-by: Sunny Patel <nueralspacetech@xxxxxxxxx>

Acked-by: SeongJae Park <sj@xxxxxxxxxx>

[...]
> @@ -865,12 +864,13 @@ static int migrate_vma_insert_huge_pmd_page(struct migrate_vma *migrate,
> if (userfaultfd_missing(vma))
> goto unlock_abort;
>
> - if (!pmd_none(*pmdp)) {
> + if (pmd_present(*pmdp)) {
> if (!is_huge_zero_pmd(*pmdp))
> goto unlock_abort;
> flush = true;
> - } else if (!pmd_none(*pmdp))
> + } else if (!pmd_none(*pmdp)) {
> goto unlock_abort;
> + }

I like this coding style [1] fix.

[1] https://docs.kernel.org/process/coding-style.html#placing-braces-and-spaces


Thanks,
SJ

[...]