From: Thorsten Blum <thorsten.blum@toblux.com>
To: akpm@linux-foundation.org, david@fromorbit.com,
zhengqi.arch@bytedance.com, roman.gushchin@linux.dev,
muchun.song@linux.dev
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Thorsten Blum <thorsten.blum@toblux.com>
Subject: [PATCH] mm: shrinker: Use min() to improve shrinker_debugfs_scan_write()
Date: Tue, 20 Aug 2024 06:22:55 +0200 [thread overview]
Message-ID: <20240820042254.99115-2-thorsten.blum@toblux.com> (raw)
Use the min() macro to simplify the shrinker_debugfs_scan_write()
function and improve its readability.
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
mm/shrinker_debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c
index 12ea5486a3e9..4a85b94d12ce 100644
--- a/mm/shrinker_debug.c
+++ b/mm/shrinker_debug.c
@@ -114,7 +114,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file,
int nid;
char kbuf[72];
- read_len = size < (sizeof(kbuf) - 1) ? size : (sizeof(kbuf) - 1);
+ read_len = min(size, sizeof(kbuf) - 1);
if (copy_from_user(kbuf, buf, read_len))
return -EFAULT;
kbuf[read_len] = '\0';
--
2.46.0
next reply other threads:[~2024-08-20 16:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 4:22 Thorsten Blum [this message]
2024-08-21 2:25 ` Muchun Song
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=20240820042254.99115-2-thorsten.blum@toblux.com \
--to=thorsten.blum@toblux.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=zhengqi.arch@bytedance.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