From: Mike Travis <travis@sgi.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Rusty Russell <rusty@rustcorp.com.au>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/8] cpumask: convert kernel trace functions
Date: Fri, 19 Dec 2008 08:54:40 -0800 [thread overview]
Message-ID: <494BD1D0.5080201@sgi.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0812191114070.28744@gandalf.stny.rr.com>
Steven Rostedt wrote:
> On Fri, 19 Dec 2008, Mike Travis wrote:
>
>> Impact: Reduce memory usage, use new cpumask API.
>>
>> Convert kernel trace functions to use struct cpumask.
>>
>
> [..]
>
>> #define for_each_buffer_cpu(buffer, cpu) \
>> - for_each_cpu_mask(cpu, buffer->cpumask)
>> + for_each_cpu(cpu, buffer->cpumask)
>>
>> #define TS_SHIFT 27
>> #define TS_MASK ((1ULL << TS_SHIFT) - 1)
>> @@ -262,7 +262,7 @@ struct ring_buffer {
>> unsigned pages;
>> unsigned flags;
>> int cpus;
>> - cpumask_t cpumask;
>> + cpumask_var_t cpumask;
>> atomic_t record_disabled;
>>
>> struct mutex mutex;
>> @@ -453,6 +453,9 @@ struct ring_buffer *ring_buffer_alloc(un
>> if (!buffer)
>> return NULL;
>>
>> + if (!alloc_cpumask_var(&buffer->cpumask, GFP_KERNEL))
>> + goto fail_free_buffer;
>> +
>
>
> How does this save memory if we just allocate a cpumask var everytime
> we allocate a ring buffer? Is cpumask_var_t a mask of possible CPUS and
> not NR_CPUS?
>
> Otherwise, I see this as just adding one extra pointer.
>
> -- Steve
Hi Steve,
Yes, eventually, the cpumask_var_t will be allocated based on cpumask_size()
which will become BITS_TO_LONG(nr_cpu_ids) instead of BITS_TO_LONGS(NR_CPUS)
as soon as the kernel becomes "cpumask" clean. (clean being that it ignores
all bits >= nr_cpu_ids.)
Note that on small NR_CPUS count systems, cpumask_var_t is a static array
and no allocation happens, so it only kicks in when CONFIG_CPUMASK_OFFSTACK=y.
Thanks,
Mike
next prev parent reply other threads:[~2008-12-19 16:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-19 16:01 [PATCH 0/8] x86 cpumask: more cpumask updates to core kernel routines Mike Travis
2008-12-19 16:01 ` [PATCH 1/8] cpumask: convert kernel/compat.c Mike Travis
2008-12-19 16:01 ` [PATCH 2/8] cpumask: convert kernel/workqueue.c Mike Travis
2008-12-19 16:01 ` [PATCH 3/8] cpumask: convert kernel time functions Mike Travis
2008-12-20 11:29 ` Rusty Russell
2008-12-19 16:01 ` [PATCH 4/8] cpumask: convert kernel trace functions Mike Travis
2008-12-19 16:16 ` Steven Rostedt
2008-12-19 16:54 ` Mike Travis [this message]
2008-12-19 17:01 ` Steven Rostedt
2008-12-20 1:41 ` Steven Rostedt
2008-12-20 11:22 ` Rusty Russell
2008-12-19 16:01 ` [PATCH 5/8] cpumask: convert rest of files in kernel/ Mike Travis
2008-12-20 1:33 ` Lai Jiangshan
2008-12-20 13:02 ` Rusty Russell
2008-12-19 16:01 ` [PATCH 6/8] cpumask: convert kernel mm functions Mike Travis
2008-12-19 18:08 ` Christoph Lameter
2008-12-19 16:01 ` [PATCH 7/8] cpumask: convert misc driver functions Mike Travis
2008-12-20 23:22 ` Ben Hutchings
2008-12-29 2:28 ` Rusty Russell
2008-12-29 15:37 ` Dean Nelson
2008-12-19 16:01 ` [PATCH 8/8] cpumask: convert other misc kernel functions Mike Travis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=494BD1D0.5080201@sgi.com \
--to=travis@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.