lkml.org 
[lkml]   [2019]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 3/8] perf: Init/fini PMU specific data
On Thu, Nov 28, 2019 at 07:14:26AM -0800, kan.liang@linux.intel.com wrote:
> +static int
> +init_system_wide_ctx_data(size_t ctx_size)
> +{
> + struct task_struct *g, *p;
> + int failed_alloc = 0;
> + unsigned long flags;
> +
> + /*
> + * Allocate perf_ctx_data for all existing threads by the first event.
> + *
> + * The perf_ctx_data for new thread will be allocated in
> + * perf_event_fork(). The perf_event_fork() is called after the thread
> + * is added into the tasklist. It guarantees that any new threads will
> + * not be missed.
> + */
> + raw_spin_lock_irqsave(&task_data_events_lock, flags);
> + if (atomic_inc_return(&nr_task_data_events) > 1)
> + goto unlock;
> +
> + read_lock(&tasklist_lock);
> +
> + for_each_process_thread(g, p) {
> + /*
> + * The PMU specific data may already be allocated by
> + * per-process event. Need to update refcounter.
> + * init_task_ctx_data_rcu() is called here.
> + * Do a quick allocation in first round with GFP_ATOMIC.
> + */
> + if (init_task_ctx_data_rcu(p, ctx_size, GFP_ATOMIC))
> + failed_alloc++;
> + }

This is atricous crap. Also it is completely broken for -RT.

\
 
 \ /
  Last update: 2019-12-02 13:41    [W:0.059 / U:6.368 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site