lkml.org 
[lkml]   [2021]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v12 01/16] perf record: Introduce thread affinity and mmap masks
On Tue, Nov 23, 2021 at 05:07:57PM +0300, Alexey Bayduraev wrote:

SNIP

> +static void record__mmap_cpu_mask_init(struct mmap_cpu_mask *mask, struct perf_cpu_map *cpus)
> +{
> + int c;
> +
> + for (c = 0; c < cpus->nr; c++)
> + set_bit(cpus->map[c], mask->bits);
> +}
> +
> +static void record__free_thread_masks(struct record *rec, int nr_threads)
> +{
> + int t;
> +
> + if (rec->thread_masks)
> + for (t = 0; t < nr_threads; t++)
> + record__thread_mask_free(&rec->thread_masks[t]);
> +
> + zfree(&rec->thread_masks);
> +}
> +
> +static int record__alloc_thread_masks(struct record *rec, int nr_threads, int nr_bits)
> +{
> + int t, ret;
> +
> + rec->thread_masks = zalloc(nr_threads * sizeof(*(rec->thread_masks)));
> + if (!rec->thread_masks) {
> + pr_err("Failed to allocate thread masks\n");
> + return -ENOMEM;
> + }
> +
> + for (t = 0; t < nr_threads; t++) {
> + ret = record__thread_mask_alloc(&rec->thread_masks[t], nr_bits);
> + if (ret)
> + goto out_free;
> + record__thread_mask_clear(&rec->thread_masks[t]);

nit, is this clear needed?

jirka

> + }
> +
> + return 0;
> +
> +out_free:
> + record__free_thread_masks(rec, nr_threads);
> +
> + return ret;
> +}
> +

SNIP

\
 
 \ /
  Last update: 2021-12-05 16:14    [W:0.742 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site