[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220414042744.13896-1-caoyixuan2019@email.szu.edu.cn>
Date: Thu, 14 Apr 2022 12:27:44 +0800
From: Yixuan Cao <caoyixuan2019@...il.szu.edu.cn>
To: akpm@...ux-foundation.org
Cc: yejiajian2018@...il.szu.edu.cn, sfr@...b.auug.org.au,
seanga2@...il.com, zhangyinan2019@...il.szu.edu.cn,
zhaochongxi2019@...il.szu.edu.cn, linux-kernel@...r.kernel.org,
hanshenghong2019@...il.szu.edu.cn,
Yixuan Cao <caoyixuan2019@...il.szu.edu.cn>
Subject: [PATCH] tools/vm/page_owner_sort.c: avoid repeated judgments
I noticed a detail that needs to be adjusted.
When judging whether a page is allocated by vmalloc,
the value of the variable "tmp" was repeatedly judged,
so the code was adjusted.
This work is coauthored by Yinan Zhang, Jiajian Ye, Shenghong Han,
Chongxi Zhao, Yuhong Feng and Yongqiang Liu.
Signed-off-by: Yixuan Cao <caoyixuan2019@...il.szu.edu.cn>
---
tools/vm/page_owner_sort.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/vm/page_owner_sort.c b/tools/vm/page_owner_sort.c
index fa2e4d2a9d68..c149427eb1c9 100644
--- a/tools/vm/page_owner_sort.c
+++ b/tools/vm/page_owner_sort.c
@@ -444,10 +444,8 @@ static int get_allocator(const char *buf, const char *migrate_info)
tmp--;
first_line = ++tmp;
tmp = strstr(tmp, "alloc_pages");
- if (tmp) {
- if (tmp && first_line <= tmp && tmp < second_line)
- allocator |= ALLOCATOR_VMALLOC;
- }
+ if (tmp && first_line <= tmp && tmp < second_line)
+ allocator |= ALLOCATOR_VMALLOC;
}
if (allocator == 0)
allocator = ALLOCATOR_OTHERS;
--
2.17.1
Powered by blists - more mailing lists