public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: Paul Jackson <pj@sgi.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	William Lee Irwin III <wli@holomorphy.com>
Subject: Re: [PATCH] mask ADT: replace cpumask_t implementation [3/22]
Date: Thu, 01 Apr 2004 12:40:25 -0800	[thread overview]
Message-ID: <1080852024.9787.87.camel@arrakis> (raw)
In-Reply-To: <20040401072232.798d98c8.pj@sgi.com>

On Thu, 2004-04-01 at 07:22, Paul Jackson wrote:
> > >  #define	cpu_online_map			cpumask_of_cpu(0)
> > >  #define	cpu_possible_map		cpumask_of_cpu(0)
> > >  ...
> > Might it make more sense to actually define a cpu_online_map &
> > cpu_possible_map for UP, rather than generating this code:
> > 
> > #define mask_of_bit(bit, T)                                            \
> > ({                                                                     \
> >        typeof(T) m;                                                    \
> >        mask_clearall(m);                                               \
> >        mask_setbit((bit), m);                                          \
> >        m;                                                              \
> > })
> > 
> > every time some code references cpu_online_map?  It'll only cost us 2
> > unsigned longs on 32-bit == 8 bytes...
> 
> Perhaps.
> 
> When I looked at the code just now, this only seemed to take a
> couple of instructions.  Do you think that there is much to gain?
> Better a couple of inline instructions than a possible uncached
> memory reference, I suspect.

Yeah, you may be right about that.

On UP it should compile as such:

cpu_online_map => cpumask_of_cpu(0) => 
mask_of_bit(0, _unused_cpumask_arg_) => 
({ typeof(_unused_cpumask_arg_) m; mask_clearall(m); mask_setbit(0, m);
m; }) => 
({ cpumask_t m; m._m[0] = 0UL; set_bit(0, m._m); m; }) 

Maybe we could #define it better on UP.  Something along the lines of:

#define cpu_online_map	({ cpumask_t up_cpu_map = { 1UL }; })

That way we'll get this inlined, plus very little code to execute?

Cheers!

-Matt


  reply	other threads:[~2004-04-01 20:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-29 12:12 [PATCH] mask ADT: replace cpumask_t implementation [3/22] Paul Jackson
2004-03-30  1:49 ` Matthew Dobson
2004-04-01 15:22   ` Paul Jackson
2004-04-01 20:40     ` Matthew Dobson [this message]
2004-04-01 20:46       ` Paul Jackson
2004-04-01 22:50         ` Matthew Dobson
2004-04-01  1:05 ` Matthew Dobson

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=1080852024.9787.87.camel@arrakis \
    --to=colpatch@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.com \
    --cc=wli@holomorphy.com \
    /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