[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z1cGaEbmDLUDpy1S@x1>
Date: Mon, 9 Dec 2024 12:02:00 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Leo Yan <leo.yan@....com>, Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
"Liang, Kan" <kan.liang@...ux.intel.com>,
James Clark <james.clark@...aro.org>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/3] perf cpumap: Add checking for reference counter
On Fri, Nov 15, 2024 at 10:49:01AM +0200, Adrian Hunter wrote:
> On 7/11/24 14:53, Leo Yan wrote:
> > For the CPU map merging test, add an extra check for the reference
> > counter before releasing the last CPU map.
> >
> > Signed-off-by: Leo Yan <leo.yan@....com>
>
> Reviewed-by: Adrian Hunter <adrian.hunter@...el.com>
Thanks, applied the series.
- Arnaldo
> > ---
> > tools/perf/tests/cpumap.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c
> > index f8187a801b8e..5ed7ff072ea3 100644
> > --- a/tools/perf/tests/cpumap.c
> > +++ b/tools/perf/tests/cpumap.c
> > @@ -167,6 +167,15 @@ static int __test__cpu_map_merge(const char *lhs, const char *rhs, int nr, const
> > cpu_map__snprint(a, buf, sizeof(buf));
> > TEST_ASSERT_VAL("failed to merge map: bad result", !strcmp(buf, expected));
> > perf_cpu_map__put(b);
> > +
> > + /*
> > + * If 'b' is a superset of 'a', 'a' points to the same map with the
> > + * map 'b'. In this case, the owner 'b' has released the resource above
> > + * but 'a' still keeps the ownership, the reference counter should be 1.
> > + */
> > + TEST_ASSERT_VAL("unexpected refcnt: bad result",
> > + refcount_read(perf_cpu_map__refcnt(a)) == 1);
> > +
> > perf_cpu_map__put(a);
> > return 0;
> > }
Powered by blists - more mailing lists