lkml.org 
[lkml]   [2022]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 07/16] mm/migration: use helper macro min_t in do_pages_stat
Date
We could use helper macro min_t to help set the chunk_nr to simplify
the code.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/migrate.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index bc79d7338780..c84eec19072a 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1858,9 +1858,7 @@ static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages,
while (nr_pages) {
unsigned long chunk_nr;

- chunk_nr = nr_pages;
- if (chunk_nr > DO_PAGES_STAT_CHUNK_NR)
- chunk_nr = DO_PAGES_STAT_CHUNK_NR;
+ chunk_nr = min_t(unsigned long, nr_pages, DO_PAGES_STAT_CHUNK_NR);

if (in_compat_syscall()) {
if (get_compat_pages_array(chunk_pages, pages,
--
2.23.0
\
 
 \ /
  Last update: 2022-03-04 10:36    [W:0.434 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site