lkml.org 
[lkml]   [2012]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 1/3] trace: Make removal of ring buffer pages atomic
From
Date
On Thu, 2012-05-03 at 18:59 -0700, Vaibhav Nagarnaik wrote:

> + get_online_cpus();
> + /*
> + * Fire off all the required work handlers
> + * Look out for offline CPUs
> + */
> + for_each_buffer_cpu(buffer, cpu) {
> + cpu_buffer = buffer->buffers[cpu];
> + if (!cpu_buffer->nr_pages_to_update ||
> + !cpu_online(cpu))
> + continue;
> +
> + schedule_work_on(cpu, &cpu_buffer->update_pages_work);
> + }
> + /*
> + * This loop is for the CPUs that are not online.
> + * We can't schedule anything on them, but it's not necessary
> + * since we can change their buffer sizes without any race.
> + */
> + for_each_buffer_cpu(buffer, cpu) {
> + cpu_buffer = buffer->buffers[cpu];
> + if (!cpu_buffer->nr_pages_to_update ||
> + cpu_online(cpu))
> + continue;
> +
> + rb_update_pages(cpu_buffer);
> }

BTW, why the two loops and not just:

for_each_buffer_cpu(buffer, cpu) {
cpu_buffer = buffer->buffers[cpu];
if (!cpu_buffer->nr_pages_to_update)
continue;

if (cpu_online(cpu))
schedule_work_on(cpu, &cpu_buffer->update_pages_work);
else
rb_update_pages(cpu_buffer);
}

??


>
> /* wait for all the updates to complete */
> for_each_buffer_cpu(buffer, cpu) {
> cpu_buffer = buffer->buffers[cpu];
> - if (cpu_buffer->nr_pages_to_update) {
> - update_pages_handler(cpu_buffer);
> - }
> + if (!cpu_buffer->nr_pages_to_update||

!cpu_buffer->nr_pages_to_update ||

-- Steve

> + !cpu_online(cpu))
> + continue;
> +
> + wait_for_completion(&cpu_buffer->update_completion);
> + /* reset this value */
> + cpu_buffer->nr_pages_to_update = 0;
> }




\
 
 \ /
  Last update: 2012-05-09 06:01    [W:0.228 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site