On Thu, Sep 5, 2024 at 11:57 AM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote: > > [..] > > well. i feel i have a much cheaper way to implement this, which > > can entirely iteration even in your original code: > > > > +/* > > + * Return the number of entries which are zero-filled according to > > + * swap_info_struct->zeromap. It isn't precise if the return value > > + * is 1 for nr > 1. In this case, it means entries have inconsistent > > + * zeromap. > > + */ > > +static inline unsigned int swap_zeromap_entries_count(swp_entry_t > > entry, int nr) > > FWIW I am not really a fan of the count() function not returning an > actual count. I think an enum with three states is more appropriate > here, and renaming the function to swap_zeromap_entries_check() or > similar. > Make sense to me, what about the below?