public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Andi Kleen <ak@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] perf record: adapt affinity to machines with #CPUs > 1K
Date: Fri, 29 Nov 2019 14:07:10 +0100	[thread overview]
Message-ID: <20191129130710.GB14169@krava> (raw)
In-Reply-To: <21bc3ad7-e1f2-68da-f004-36354a6e40ea@linux.intel.com>

On Fri, Nov 29, 2019 at 01:05:26PM +0300, Alexey Budankov wrote:

SNIP

>  # undef REASON
>  #endif
>  
> -	CPU_ZERO(&rec->affinity_mask);
>  	rec->opts.affinity = PERF_AFFINITY_SYS;
>  
>  	rec->evlist = evlist__new();
> @@ -2499,6 +2504,14 @@ int cmd_record(int argc, const char **argv)
>  
>  	symbol__init(NULL);
>  
> +	rec->affinity_mask.nbits = cpu__max_cpu();
> +	rec->affinity_mask.bits = bitmap_alloc(rec->affinity_mask.nbits);
> +	if (!rec->affinity_mask.bits) {
> +		pr_err("Failed to allocate thread mask for %ld cpus\n", rec->affinity_mask.nbits);
> +		return -ENOMEM;
> +	}
> +	pr_debug2("thread mask[%ld]: empty\n", rec->affinity_mask.nbits);

above can be done only for (rec->opts.affinity != PERF_AFFINITY_SYS)


> +
>  	err = record__auxtrace_init(rec);
>  	if (err)
>  		goto out;
> @@ -2613,6 +2626,8 @@ int cmd_record(int argc, const char **argv)
>  
>  	err = __cmd_record(&record, argc, argv);
>  out:
> +	if (rec->affinity_mask.bits)
> +		bitmap_free(rec->affinity_mask.bits);
>  	evlist__delete(rec->evlist);
>  	symbol__exit();
>  	auxtrace_record__free(rec->itr);
> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
> index 30ff7aef06f2..615d05870849 100644
> --- a/tools/perf/util/mmap.c
> +++ b/tools/perf/util/mmap.c
> @@ -219,6 +219,9 @@ static void perf_mmap__aio_munmap(struct mmap *map __maybe_unused)
>  
>  void mmap__munmap(struct mmap *map)
>  {
> +	if (map->affinity_mask.bits)
> +		bitmap_free(map->affinity_mask.bits);

you don't need to check map->affinity_mask.bits, it's checked in free

jirka


  reply	other threads:[~2019-11-29 13:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29 10:01 [PATCH v3 0/3] perf record: adapt NUMA awareness to machines with #CPUs > 1K Alexey Budankov
2019-11-29 10:02 ` [PATCH v3 1/3] tools bitmap: implement bitmap_equal() operation at bitmap API Alexey Budankov
2019-11-29 10:04 ` [PATCH v3 2/3] perf mmap: declare type for cpu mask of arbitrary length Alexey Budankov
2019-11-29 13:09   ` Jiri Olsa
2019-11-29 15:43     ` Alexey Budankov
2019-11-29 10:05 ` [PATCH v3 3/3] perf record: adapt affinity to machines with #CPUs > 1K Alexey Budankov
2019-11-29 13:07   ` Jiri Olsa [this message]
2019-11-29 15:49     ` Alexey Budankov
  -- strict thread matches above, loose matches on Subject: below --
2019-11-26 11:15 [PATCH v3 0/3] perf record: adapt NUMA awareness " Alexey Budankov
2019-11-26 11:22 ` [PATCH v3 3/3] perf record: adapt affinity " Alexey Budankov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191129130710.GB14169@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox