lkml.org 
[lkml]   [2011]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3] trace: Add per_cpu ring buffer control files
From
Date
On Mon, 2011-08-22 at 15:09 -0700, Vaibhav Nagarnaik wrote:
>
> @@ -3740,10 +3757,6 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
> !cpumask_test_cpu(cpu, buffer_b->cpumask))
> goto out;
>
> - /* At least make sure the two buffers are somewhat the same */
> - if (buffer_a->pages != buffer_b->pages)
> - goto out;
> -
> ret = -EAGAIN;
>
> if (ring_buffer_flags != RB_BUFFERS_ON)
> @@ -3758,6 +3771,12 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
> cpu_buffer_a = buffer_a->buffers[cpu];
> cpu_buffer_b = buffer_b->buffers[cpu];

I would move the cpu_buffer_(ab) assignments up instead, as I want the
EINVAL to have dominance. The record_disable just says that we are
temporarily out of commission, when in fact it could be invalid. Thus
the invalid conditions need to be treated first.

-- Steve

>
> + ret = -EINVAL;
> + /* At least make sure the two buffers are somewhat the same */
> + if (cpu_buffer_a->pages != cpu_buffer_b->pages)
> + goto out;
> +
> + ret = -EAGAIN;
> if (atomic_read(&cpu_buffer_a->record_disabled))
> goto out;
>




\
 
 \ /
  Last update: 2011-08-23 02:51    [W:0.193 / U:5.700 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site