Re: [PATCH v6] Unified trace buffer

From: Mike Travis
Date: Fri Sep 26 2008 - 18:28:19 EST


Peter Zijlstra wrote:
> On Fri, 2008-09-26 at 14:05 -0400, Steven Rostedt wrote:
>> +struct ring_buffer {
>> + unsigned long size;
>> + unsigned pages;
>> + unsigned flags;
>> + int cpus;
>> + atomic_t record_disabled;
>> +
>> + struct mutex mutex;
>> +
>> + /* FIXME: this should be online CPUS */
>> + struct ring_buffer_per_cpu *buffers[NR_CPUS];
>
> actually nr_possible makes sense, and you might consider always
> allocating buffers (and keeping them for offlined cpus) to avoid massive
> allocations/frees cpu-hotplug events.
>
> Mike Travis has been going over the kernel removing constructs like
> this, and replacing them with dynamically allocated arrays of
> nr_possible.
>
>> +};

The other thing to consider is using a percpu variable.

Cheers,
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/