summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYixuan Cao <caoyixuan2019@email.szu.edu.cn>2022-04-28 23:15:57 -0700
committerakpm <akpm@linux-foundation.org>2022-04-28 23:15:57 -0700
commitc7c4ab859642830a14c45785ca7866659b65fc44 (patch)
tree35e8cdbebf61e884d1e3548c5870f44a735b3d55
parentf09654bb88127473b4baf3bc0b68d4d4695aca7b (diff)
downloadlinux-starfive-c7c4ab859642830a14c45785ca7866659b65fc44.tar.gz
linux-starfive-c7c4ab859642830a14c45785ca7866659b65fc44.tar.bz2
linux-starfive-c7c4ab859642830a14c45785ca7866659b65fc44.zip
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. Link: https://lkml.kernel.org/r/20220414042744.13896-1-caoyixuan2019@email.szu.edu.cn Signed-off-by: Yixuan Cao <caoyixuan2019@email.szu.edu.cn> Cc: Chongxi Zhao <zhaochongxi2019@email.szu.edu.cn> Cc: Haowen Bai <baihaowen@meizu.com> Cc: Jiajian Ye <yejiajian2018@email.szu.edu.cn> Cc: Sean Anderson <seanga2@gmail.com> Cc: Shenghong Han <hanshenghong2019@email.szu.edu.cn> Cc: Yinan Zhang <zhangyinan2019@email.szu.edu.cn> Cc: Yongqiang Liu <liuyongqiang13@huawei.com> Cc: Yuhong Feng <yuhongf@szu.edu.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--tools/vm/page_owner_sort.c6
1 files 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;