lkml.org 
[lkml]   [2023]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -next v7 2/4] mm/zswap: skip invalid or unchanged parameter
On Sun, Mar 26, 2023 at 01:53:27PM +0900, Sergey Senozhatsky wrote:
> > > + if (kstrtobool(val, &res))
> > > + return -EINVAL;
> > > +
> > > + /* no change required */
> > > + if (res == *(bool *)kp->arg)
> > > + return 0;
> >
> > Bool kernel param can be any of these letters 'YyTt1NnFf0'. Doing things
> > to kp->arg outside of kernel/params.c is not going to be easy, let's not
> > even try.
>
> Please disregard my previous email. kp->arg is always true or false
> at this point. I'd still prefer to not do kp->arg in zswap.

The whole parameter handling in zswap is a mess and I don't really
have a good idea how to solve it all.

But for this "paramter not changed" case I think we can helper a lot
by adding a core moduleparam.h helper to encapsule it. I.e.:

static inline bool param_bool_unchanged(bool val,
const struct kernel_param *kp)

return val == *(bool *)kp->arg);
}

and at least keep it out of zswap.

\
 
 \ /
  Last update: 2023-03-27 01:25    [W:0.060 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site