tools/mm/page_owner_sort.c: fix TGID output when cull=tg is used
authorSteve Chou <steve_chou@pesi.com.tw>
Tue, 11 Apr 2023 03:49:28 +0000 (11:49 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 16 Apr 2023 17:41:25 +0000 (10:41 -0700)
When using cull option with 'tg' flag, the fprintf is using pid instead
of tgid. It should use tgid instead.

Link: https://lkml.kernel.org/r/20230411034929.2071501-1-steve_chou@pesi.com.tw
Fixes: 9c8a0a8e599f4a ("tools/vm/page_owner_sort.c: support for user-defined culling rules")
Signed-off-by: Steve Chou <steve_chou@pesi.com.tw>
Cc: Jiajian Ye <yejiajian2018@email.szu.edu.cn>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/mm/page_owner_sort.c

index 7c2ac124cdc83a21be7ba9bf010b5b1dd120af24..99798894b8790544b3dd83c222c9237af32b94a7 100644 (file)
@@ -857,7 +857,7 @@ int main(int argc, char **argv)
                        if (cull & CULL_PID || filter & FILTER_PID)
                                fprintf(fout, ", PID %d", list[i].pid);
                        if (cull & CULL_TGID || filter & FILTER_TGID)
-                               fprintf(fout, ", TGID %d", list[i].pid);
+                               fprintf(fout, ", TGID %d", list[i].tgid);
                        if (cull & CULL_COMM || filter & FILTER_COMM)
                                fprintf(fout, ", task_comm_name: %s", list[i].comm);
                        if (cull & CULL_ALLOCATOR) {