From: David Hildenbrand <david@redhat.com>
To: Wang ShaoBo <bobo.shaobowang@huawei.com>, akpm@linux-foundation.org
Cc: weiyongjun1@huawei.com, huawei.libin@huawei.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: use clamp() to simplify code
Date: Thu, 21 Oct 2021 10:50:52 +0200 [thread overview]
Message-ID: <60939c5c-2b1f-a7d7-61b3-f8f501a4893f@redhat.com> (raw)
In-Reply-To: <20211021034830.1049150-1-bobo.shaobowang@huawei.com>
On 21.10.21 05:48, Wang ShaoBo wrote:
> This patch uses clamp() to simplify code in init_per_zone_wmark_min().
>
> Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
> ---
> mm/page_alloc.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index b37435c274cf..d0449212a824 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -8460,16 +8460,12 @@ int __meminit init_per_zone_wmark_min(void)
> lowmem_kbytes = nr_free_buffer_pages() * (PAGE_SIZE >> 10);
> new_min_free_kbytes = int_sqrt(lowmem_kbytes * 16);
>
> - if (new_min_free_kbytes > user_min_free_kbytes) {
> - min_free_kbytes = new_min_free_kbytes;
> - if (min_free_kbytes < 128)
> - min_free_kbytes = 128;
> - if (min_free_kbytes > 262144)
> - min_free_kbytes = 262144;
> - } else {
> + if (new_min_free_kbytes > user_min_free_kbytes)
> + min_free_kbytes = clamp(new_min_free_kbytes, 128, 262144);
> + else
> pr_warn("min_free_kbytes is not updated to %d because user defined value %d is preferred\n",
> new_min_free_kbytes, user_min_free_kbytes);
> - }
> +
> setup_per_zone_wmarks();
> refresh_zone_stat_thresholds();
> setup_per_zone_lowmem_reserve();
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2021-10-21 8:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 3:48 Wang ShaoBo
2021-10-21 8:50 ` 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=60939c5c-2b1f-a7d7-61b3-f8f501a4893f@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bobo.shaobowang@huawei.com \
--cc=huawei.libin@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=weiyongjun1@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