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

From: David Hildenbrand (Arm)

Date: Sun Apr 19 2026 - 04:12:35 EST


On 4/18/26 19:18, Sunny Patel wrote:
On 4/17/26 01:52, SeongJae Park wrote:
On Thu, 16 Apr 2026 21:44:15 +0200 "David Hildenbrand (Arm)" <david@xxxxxxxxxx> wrote:

[...]

is_huge_zero_pmd() checks pmd_present(), so we didn't have a bug before.

We could also do:

if (is_huge_zero_pmd(*pmdp)) {
flush = true;
} else if (!pmd_none(*pmdp)) {
goto unlock_abort;
}

Then we could even further remove the braces and reduce one more line, nice!

is_huge_zero_pmd() didn't check for pmd_present as of now as per the current implementation of it so additional check require for pmd_present().

I don't know what you mean. Here is the code in the tree:
static inline bool is_huge_zero_pmd(pmd_t pmd)
{
return pmd_present(pmd) && is_huge_zero_pfn(pmd_pfn(pmd));
}

--
Cheers,

David