linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Liu Shixin <liushixin2@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: [PATCH] mm/shuffle: convert module_param_call to module_param_cb
Date: Fri, 9 Sep 2022 18:52:25 +0200	[thread overview]
Message-ID: <712acfd4-f7f4-457e-f1a2-ca0f076c6d24@redhat.com> (raw)
In-Reply-To: <20220909083947.3595610-1-liushixin2@huawei.com>

On 09.09.22 10:39, Liu Shixin wrote:
> 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.
> 
> Signed-off-by: Liu Shixin <liushixin2@huawei.com>
> ---
>   mm/shuffle.c | 21 ++++++++++-----------
>   1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/mm/shuffle.c b/mm/shuffle.c
> index c13c33b247e8..fb1393b8b3a9 100644
> --- a/mm/shuffle.c
> +++ b/mm/shuffle.c
> @@ -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


LGTM

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



      reply	other threads:[~2022-09-09 16:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09  8:39 Liu Shixin
2022-09-09 16:52 ` David Hildenbrand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=712acfd4-f7f4-457e-f1a2-ca0f076c6d24@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liushixin2@huawei.com \
    --cc=rusty@rustcorp.com.au \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox