From: Yixuan Cao Date: Fri, 29 Apr 2022 06:15:57 +0000 (-0700) Subject: tools/vm/page_owner_sort.c: avoid repeated judgments X-Git-Tag: for-5.19/block-exec-2022-06-02~28^2~375 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=c7c4ab859642830a14c45785ca7866659b65fc44;p=linux-block.git 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 Cc: Chongxi Zhao Cc: Haowen Bai Cc: Jiajian Ye Cc: Sean Anderson Cc: Shenghong Han Cc: Yinan Zhang Cc: Yongqiang Liu Cc: Yuhong Feng Signed-off-by: Andrew Morton --- 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;