[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1336534682.14207.197.camel@gandalf.stny.rr.com>
Date: Tue, 08 May 2012 23:38:02 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Vaibhav Nagarnaik <vnagarnaik@...gle.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...hat.com>,
Laurent Chavey <chavey@...gle.com>,
Justin Teravest <teravest@...gle.com>,
David Sharp <dhsharp@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 1/3] trace: Make removal of ring buffer pages atomic
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;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists