Re: [RFC PATCH 11/12] mm: rename non_swap_entry() to is_non_present_entry()

From: Gregory Price
Date: Fri Oct 24 2025 - 15:08:19 EST


On Fri, Oct 24, 2025 at 08:41:27AM +0100, Lorenzo Stoakes wrote:
> Referring to non-swap swap entries is simply confusing. While we store
> non-present entries unrelated to swap itself, in swp_entry_t fields, we can
> avoid referring to them as 'non-swap' entries.
>
--- >8
> static void ptep_zap_swap_entry(struct mm_struct *mm, swp_entry_t entry)
> {
> - if (!non_swap_entry(entry))
> + if (!is_non_present_entry(entry))
> dec_mm_counter(mm, MM_SWAPENTS);

I guess the question I have here is whether it's feasible to invert the
logic to avoid the double-negative not-logic.

Anyway, naming is hard. In general I appreciate the additional clarity,
even if we still have some `!is_non_*` logic sprinkled about.

--- addt'l aside semi-unrelated to your patches

I can see where this is going in the long run, but the name of this
function (ptep_zap_swap_entry) is as frustrating as the check for
non_swap_entry(entry).

may as well call it `ptep_zap_leaf_thingy` if it's handling multiple
special entry types.

but renaming even more functions in strange places outside scope here.

---

~Gregory