Re: [RFC PATCH 11/12] mm: rename non_swap_entry() to is_non_present_entry()
From: Lorenzo Stoakes
Date: Fri Oct 24 2025 - 16:18:55 EST
On Fri, Oct 24, 2025 at 03:07:40PM -0400, Gregory Price wrote:
> 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.
Ah well, see the next patch :)
>
> Anyway, naming is hard. In general I appreciate the additional clarity,
> even if we still have some `!is_non_*` logic sprinkled about.
Again this is a prelude to 12/12 :P
>
> --- 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.
Yeah there's more to do for sure, I'll add this to the list... :)
>
> ---
>
> ~Gregory
Cheers, Lorenzo