[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YG97Id/zNgdFLeWr@krava>
Date: Thu, 8 Apr 2021 23:52:33 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: "Bayduraev, Alexey V" <alexey.v.bayduraev@...ux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Alexei Budankov <abudankov@...wei.com>,
Alexander Antonov <alexander.antonov@...ux.intel.com>
Subject: Re: [PATCH v4 08/12] perf record: introduce --threads=<spec> command
line option
On Tue, Apr 06, 2021 at 11:49:06AM +0300, Bayduraev, Alexey V wrote:
SNIP
> Suggested-by: Jiri Olsa <jolsa@...nel.org>
> Suggested-by: Namhyung Kim <namhyung@...nel.org>
> Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>
> ---
> tools/include/linux/bitmap.h | 11 ++
> tools/lib/bitmap.c | 14 ++
> tools/perf/builtin-record.c | 317 ++++++++++++++++++++++++++++++++++-
> tools/perf/util/record.h | 1 +
> 4 files changed, 341 insertions(+), 2 deletions(-)
>
> diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h
> index 477a1cae513f..2eb1d1084543 100644
> --- a/tools/include/linux/bitmap.h
> +++ b/tools/include/linux/bitmap.h
> @@ -18,6 +18,8 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
> int __bitmap_equal(const unsigned long *bitmap1,
> const unsigned long *bitmap2, unsigned int bits);
> void bitmap_clear(unsigned long *map, unsigned int start, int len);
> +int __bitmap_intersects(const unsigned long *bitmap1,
> + const unsigned long *bitmap2, unsigned int bits);
>
> #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
>
> @@ -178,4 +180,13 @@ static inline int bitmap_equal(const unsigned long *src1,
> return __bitmap_equal(src1, src2, nbits);
> }
>
> +static inline int bitmap_intersects(const unsigned long *src1,
> + const unsigned long *src2, unsigned int nbits)
> +{
> + if (small_const_nbits(nbits))
> + return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
> + else
> + return __bitmap_intersects(src1, src2, nbits);
> +}
> +
> #endif /* _PERF_BITOPS_H */
> diff --git a/tools/lib/bitmap.c b/tools/lib/bitmap.c
> index 5043747ef6c5..3cc3a5b43bb5 100644
> --- a/tools/lib/bitmap.c
> +++ b/tools/lib/bitmap.c
> @@ -86,3 +86,17 @@ int __bitmap_equal(const unsigned long *bitmap1,
>
> return 1;
> }
> +
> +int __bitmap_intersects(const unsigned long *bitmap1,
> + const unsigned long *bitmap2, unsigned int bits)
> +{
> + unsigned int k, lim = bits/BITS_PER_LONG;
> + for (k = 0; k < lim; ++k)
> + if (bitmap1[k] & bitmap2[k])
> + return 1;
> +
> + if (bits % BITS_PER_LONG)
> + if ((bitmap1[k] & bitmap2[k]) & BITMAP_LAST_WORD_MASK(bits))
> + return 1;
> + return 0;
> +}
please move __bitmap_intersects function to the separate patch
jirka
Powered by blists - more mailing lists