Skip to content

Commit

Permalink
mm/shuffle: convert module_param_call to module_param_cb
Browse files Browse the repository at this point in the history
module_param_call is now completely consistent with module_param_cb, so
there is no need to keep two macros.  Convert module_param_call to
module_param_cb since former is obsolete and latter is more kernel-ish.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Liu Shixin <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Liu Shixin <[email protected]>
Cc: Paul Russel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Liu Shixin authored and akpm00 committed Oct 3, 2022
1 parent f1f3afd commit 85a3410
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions mm/shuffle.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@
DEFINE_STATIC_KEY_FALSE(page_alloc_shuffle_key);

static bool shuffle_param;
static int shuffle_show(char *buffer, const struct kernel_param *kp)
{
return sprintf(buffer, "%c\n", shuffle_param ? 'Y' : 'N');
}

static __meminit int shuffle_store(const char *val,
static __meminit int shuffle_param_set(const char *val,
const struct kernel_param *kp)
{
int rc = param_set_bool(val, kp);

if (rc < 0)
return rc;
if (shuffle_param)
if (param_set_bool(val, kp))
return -EINVAL;
if (*(bool *)kp->arg)
static_branch_enable(&page_alloc_shuffle_key);
return 0;
}
module_param_call(shuffle, shuffle_store, shuffle_show, &shuffle_param, 0400);

static const struct kernel_param_ops shuffle_param_ops = {
.set = shuffle_param_set,
.get = param_get_bool,
};
module_param_cb(shuffle, &shuffle_param_ops, &shuffle_param, 0400);

/*
* For two pages to be swapped in the shuffle, they must be free (on a
Expand Down

0 comments on commit 85a3410

Please sign in to comment.