linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmalloc: Replace the ternary conditional operator with min()
@ 2023-06-09  6:13 Lu Hongfei
  2023-06-09  7:09 ` Lorenzo Stoakes
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Lu Hongfei @ 2023-06-09  6:13 UTC (permalink / raw)
  To: Andrew Morton, Uladzislau Rezki, Christoph Hellwig,
	Lorenzo Stoakes, open list:VMALLOC, open list
  Cc: opensource.kernel, luhongfei

It would be better to replace the traditional ternary conditional
operator with min() in zero_iter

Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
---
 mm/vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 29077d61ff81..42df032e6c27
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -3571,7 +3571,7 @@ static size_t zero_iter(struct iov_iter *iter, size_t count)
 	while (remains > 0) {
 		size_t num, copied;
 
-		num = remains < PAGE_SIZE ? remains : PAGE_SIZE;
+		num = min(remains, PAGE_SIZE);
 		copied = copy_page_to_iter_nofault(ZERO_PAGE(0), 0, num, iter);
 		remains -= copied;
 
-- 
2.39.0



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-06-10 22:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09  6:13 [PATCH] mm/vmalloc: Replace the ternary conditional operator with min() Lu Hongfei
2023-06-09  7:09 ` Lorenzo Stoakes
2023-06-09  8:48   ` Lorenzo Stoakes
2023-06-10 20:09     ` David Laight
2023-06-10 21:06       ` Lorenzo Stoakes
2023-06-10 22:08         ` Andrew Morton
2023-06-10 22:23           ` Lorenzo Stoakes
2023-06-10 22:29           ` David Laight
2023-06-10 22:18         ` David Laight
2023-06-10 22:35           ` Lorenzo Stoakes
2023-06-09  8:28 ` kernel test robot
2023-06-09  9:12 ` kernel test robot
2023-06-09  9:35 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox