Re: [PATCH mm-new 2/3] mm: clean up and expose is_guard_pte_marker()

From: David Hildenbrand
Date: Wed Sep 17 2025 - 06:33:12 EST


On 14.09.25 16:35, Lance Yang wrote:
From: Lance Yang <lance.yang@xxxxxxxxx>

is_guard_pte_marker() performs a redundant check because it calls both
is_pte_marker() and is_guard_swp_entry(), both of which internally check
for a PTE marker.

is_guard_pte_marker()
|- is_pte_marker()
| `- is_pte_marker_entry() // First check
`- is_guard_swp_entry()
`- is_pte_marker_entry() // Second, redundant check

While a modern compiler could likely optimize this away, let's have clean
code and not rely on it ;)

Also, make it available for hugepage collapsing code.

Cc: Kairui Song <kasong@xxxxxxxxxxx>
Signed-off-by: Lance Yang <lance.yang@xxxxxxxxx>
---

Acked-by: David Hildenbrand <david@xxxxxxxxxx>

--
Cheers

David / dhildenb