• Ian Rogers's avatar
    perf comm: Fix comm_str__put() for reference count checking · de6a9083
    Ian Rogers authored
    Searching for the entry in the array needs to avoid the intermediate
    pointer with reference count checking.
    
    Refactor the array removal to binary search for the entry.
    
    Change the array to hold an entry with a reference count (so the
    intermediate pointer can work) and remove from the array when the
    reference count on a comm_str falls to 1.
    
    Fixes: 13ca6287 ("perf comm: Add reference count checking to 'struct comm_str'")
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Leo Yan <leo.yan@linux.dev>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20240508035301.1554434-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    de6a9083
comm.c 4.88 KB