Re: [PATCH v2] perf thread_map: Deduplicate numerically equivalent PID and TID strings
From: Hui Su
Date: Mon Sep 21 2026 - 13:45:06 EST
> Why not parse the pid_str into the intlist and then remove duplicates?
Good point. I initially kept the strlist and used a separate intlist as a
seen-set to minimize the change.
One wrinkle is that intlist__new(pid_str) currently treats duplicate numeric
values as an error: intlist__parse_list() propagates -EEXIST from
intlist__add(). Thus, "123,0123" currently makes intlist__new() fail instead
of deduplicating the values.
I think the cleaner solution is to make intlist parsing fold duplicate values,
for example by using intlist__findnew(), and then iterate the intlist directly
in the PID/TID paths. That removes both the extra strlist and the separate
seen-set.
I'll check whether any existing intlist__new() users rely on duplicates being
rejected, and whether any thread_map callers rely on the current lexicographic
ordering from strlist, since intlist iteration is numeric.
I'll rework it that way for v3.
Thanks,
Hui