On Mon, Sep 14, 2026 at 04:01:02PM +0200, David Hildenbrand (Arm) wrote: > On 9/14/26 09:30, Yeoreum Yun wrote: > > Introduce size_to_shift() for future users that need to > > obtain shift of a huge-page which is other than pmd_psize(). > > > > Suggested-by: David Hildenbrand (Arm) <[email protected]> > > Signed-off-by: Yeoreum Yun <[email protected]> > > --- > > tools/testing/selftests/mm/vm_util.c | 10 +++++++++- > > tools/testing/selftests/mm/vm_util.h | 1 + > > 2 files changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/mm/vm_util.c > > b/tools/testing/selftests/mm/vm_util.c > > index fd1432dc6152..1fef1266429f 100644 > > --- a/tools/testing/selftests/mm/vm_util.c > > +++ b/tools/testing/selftests/mm/vm_util.c > > @@ -157,6 +157,14 @@ bool check_for_pattern(FILE *fp, const char *pattern, > > char *buf, size_t len) > > return false; > > } > > > > +uint64_t size_to_shift(uint64_t size) > > +{ > > + if (__builtin_popcountll(size) != 1) > > + return 0; > > + > > + return ffsl(size) - 1; > > +} > > Could likely just be an inline helper?
Okay. If there is no comments on today, I'll post tomorrow with this. -- Sincerely, Yeoreum Yun

