Re: [PATCH v2] tracing: Allocate mask_str buffer dynamically

From: Steven Rostedt
Date: Thu Oct 26 2017 - 07:16:03 EST


On Thu, 26 Oct 2017 00:20:28 +0800
changbin.du@xxxxxxxxx wrote:

> From: Changbin Du <changbin.du@xxxxxxxxx>
>
> The default NR_CPUS can be very large, but actual possible nr_cpu_ids
> usually is very small. For my x86 distribution, the NR_CPUS is 8192 and
> nr_cpu_ids is 4. About 2 pages are wasted.
>
> Most machines don't have so many CPUs, so define a array with NR_CPUS
> just wastes memory. So let's allocate the buffer dynamically when need.
>
> The exact buffer size should be:
> DIV_ROUND_UP(nr_cpu_ids, 4) + nr_cpu_ids/32 + 2;
>
> Example output:
> ff,ffffffff
>
> Signed-off-by: Changbin Du <changbin.du@xxxxxxxxx>
>

Thanks for sending this. I'm currently traveling for conferences, and
may miss looking at this when I get back. Please send me a friendly
ping reply to this email next week, if you don't hear from me sooner.

-- Steve