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

SeongJae Park
2026-04-16T23:51:07Z

On Tue, 14 Apr 2026 19:43:38 +0530 Sunny Patel <nueralspacetech@gmail.com> 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@gmail.com>

Acked-by: SeongJae Park <sj@kernel.org>

[...]
> @@ -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 …