Commit 85a34107 authored by Liu Shixin's avatar Liu Shixin Committed by Andrew Morton

mm/shuffle: convert module_param_call to module_param_cb

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/20220909083947.3595610-1-liushixin2@huawei.comSigned-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Liu Shixin <liushixin2@huawei.com>
Cc: Paul Russel <rusty@rustcorp.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f1f3afd5
...@@ -12,23 +12,22 @@ ...@@ -12,23 +12,22 @@
DEFINE_STATIC_KEY_FALSE(page_alloc_shuffle_key); DEFINE_STATIC_KEY_FALSE(page_alloc_shuffle_key);
static bool shuffle_param; 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) const struct kernel_param *kp)
{ {
int rc = param_set_bool(val, kp); if (param_set_bool(val, kp))
return -EINVAL;
if (rc < 0) if (*(bool *)kp->arg)
return rc;
if (shuffle_param)
static_branch_enable(&page_alloc_shuffle_key); static_branch_enable(&page_alloc_shuffle_key);
return 0; 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 * For two pages to be swapped in the shuffle, they must be free (on a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment