Re: [PATCH] selftests/mm: Fix soft-dirty kselftest supported check

Audra Mitchell
2026-03-25T16:23:58Z

On Tue, Mar 24, 2026 at 04:24:45PM -0700, Andrew Morton wrote:
> On Tue, 24 Mar 2026 16:23:24 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Mon, 23 Mar 2026 12:56:33 +0100 "David Hildenbrand (Arm)" <david@kernel.org> wrote:
> >
> > > > + supported = __pagemap_scan_get_categories(fd, test_area, &r) >= 0;
> > >
> > > You have to cast it to a (long) first before comparing, like we do in
> > > pagemap_scan_get_categories().
> > >
> > >
> > > Maybe best written as
> > >
> > > long ret = __pagemap_scan_get_categories(fd, test_area, &r);
> > >
> > > if (ret >= 0)
> > > supported = 1;
> > >
> > > > + ksft_print_msg("errno: %d\n", errno);
> > >
> > > I guess we should drop that, was mostly for testing.

Wouldn't it be prudent to also update __pagemap_scan_get_categories
return type to a long? Right now its uint64_t, but we expect a long
to be returned from the ioctl:

static long do_pagemap_cmd(struct file *file, unsigned int cmd,
unsigned long arg)

I've made the other changes, but I'll wait to push the next version after
this feedback. Thanks!