kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@redhat.com>, kvm-devel <kvm@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] kvm: use cpumask_var_t for cpus_hardware_enabled
Date: Mon, 08 Dec 2008 06:29:33 -0800	[thread overview]
Message-ID: <493D2F4D.3090702@sgi.com> (raw)
In-Reply-To: <200812082220.42790.rusty@rustcorp.com.au>

Rusty Russell wrote:
> On Monday 08 December 2008 20:16:44 Avi Kivity wrote:
>> Rusty Russell wrote:
>>>> This isn't on stack, so it isn't buying us anything.
>>>>     
>>> It's the CONFIG_NR_CPUS=4096 but nr_cpu_ids=4 case which we win using
>>> dynamic allocation.  Gotta love distribution kernels.
>>>
>>>   
>> What does it buy? 4096/8 = 512 bytes statically allocated?
> 
> It adds up, and 4096 seems to be only the start of the insanityH^H^Hfun.

The real win though is when cpumask_size represents the actual size of the
cpumask (based on # of possible cpus) instead of the pre-configured size
of NR_CPUS.  So for 99.9% of the systems (having 64 or fewer cpus), the
savings will be 504 bytes not allocated.

> 
>>> Not quite.  If !CONFIG_CPUMASK_OFFSTACK, cpumask_var_t == cpumask_t[1].
>>> Blame Linus :)
>>>   
>> Hm, is there a C trick which will error out when allocating something on 
>> the stack, but work when allocating statically?  I can think of 
>> something to do the reverse, but that doesn't help.
> 
> We also need to prevent assignment, eg:
> 
> 	*foo = *bar;
> 
> Because when we allocate them, we'll cut them to size.
> 
> Cheers,
> Rusty.


      reply	other threads:[~2008-12-08 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200812072125.45757.rusty@rustcorp.com.au>
2008-12-07 15:55 ` [PATCH 2/2] kvm: use cpumask_var_t for cpus_hardware_enabled Avi Kivity
2008-12-08  6:05   ` Rusty Russell
2008-12-08  9:46     ` Avi Kivity
2008-12-08 11:50       ` Rusty Russell
2008-12-08 14:29         ` Mike Travis [this message]

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=493D2F4D.3090702@sgi.com \
    --to=travis@sgi.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).