From: Paul Jackson <pj@sgi.com>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: colpatch@us.ibm.com, linux-kernel@vger.kernel.org,
mbligh@aracnet.com, akpm@osdl.org, haveblue@us.ibm.com,
hch@infradead.org
Subject: Re: [PATCH] Introduce nodemask_t ADT [0/7]
Date: Mon, 22 Mar 2004 18:39:18 -0800 [thread overview]
Message-ID: <20040322183918.5e0f17c7.pj@sgi.com> (raw)
In-Reply-To: <20040323020940.GV2045@holomorphy.com>
> go for it
I'll try.
The main thing I keep seeing, when I look at the resulting machine
code, is that things such as the following (stripped of everything
except the bare bones hardwired stuff I needed to compile):
#define BITS_TO_LONGS(i) (i+63)/64
#define NR_CPUS 64
#define __mask(bits) struct { unsigned long _m[BITS_TO_LONGS(bits)]; }
typedef __mask(NR_CPUS) cpumask_t;
#define mask_and(d,s1,s2) \
do { \
int i; \
for (i = 0; i < sizeof(d)/sizeof(unsigned long); i++) \
d._m[i] = s1._m[i] & s2._m[i]; \
} while(0)
unsigned long f(cpumask_t c, cpumask_t d, cpumask_t e)
{
mask_and(c,d,e);
return c._m[0];
}
end up producing quite fine code, such as a single inline 64 bit and
instruction, with no evidence of the for loop, array or struct wrapper,
on an ia64 (gcc 3.2.3 -O2) for the interesting guts of my silly little
test function f().
Objdump -d of function f() in above:
4000000000000610 <f>:
4000000000000610: 0d 60 c0 19 3f 23 [MFI] adds r12=-16,r12
4000000000000616: 00 00 00 02 00 00 nop.f 0x0
400000000000061c: 21 0a 31 80 and r8=r34,r33;;
4000000000000620: 11 00 00 00 01 00 [MIB] nop.m 0x0
4000000000000626: c0 80 30 00 42 80 adds r12=16,r12
400000000000062c: 08 00 84 00 br.ret.sptk.many b0;;
>From this I conjecture that I can provide a single call:
cpumask_and(cpumask_t d, cpumask_t s1, cpumask_t s2);
that works on both normal (1 to 32 cpu) systems and on big iron systems,
with traditional 'C' pass by value semantics, all derived from a single
mask type that works for both node and cpu masks.
The one sticky point evident to me so far would be if some generic code
were passing a cpumask_t across a function call boundary, and needed to
be optimum for both small and sparc64 - one would want to pass by value,
the other would want to pass a pointer to the cpumask.
This is not your fathers 'C'. The compile time inlining and
optimization provided by gcc enables it to do a lot more than Dennis
Ritchie's original C compiler that I learned on.
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
next prev parent reply other threads:[~2004-03-23 2:41 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-18 23:04 Matthew Dobson
2004-03-18 23:23 ` Jesse Barnes
2004-03-18 23:32 ` Martin J. Bligh
2004-03-18 23:37 ` Jesse Barnes
2004-03-18 23:43 ` Martin J. Bligh
2004-03-18 23:59 ` Jesse Barnes
2004-03-19 16:20 ` Martin J. Bligh
2004-03-19 0:58 ` Zwane Mwaikambo
2004-03-19 1:11 ` Jesse Barnes
2004-03-19 1:34 ` Zwane Mwaikambo
2004-03-19 1:40 ` Jesse Barnes
2004-03-19 1:08 ` Paul Jackson
2004-03-19 0:01 ` Matthew Dobson
2004-03-18 23:58 ` Matthew Dobson
2004-03-19 2:55 ` William Lee Irwin III
2004-03-19 0:59 ` Paul Jackson
2004-03-19 1:19 ` Matthew Dobson
2004-03-19 1:45 ` Paul Jackson
2004-03-19 22:51 ` Matthew Dobson
2004-03-19 23:42 ` Paul Jackson
2004-03-19 1:48 ` Paul Jackson
2004-03-19 1:56 ` Paul Jackson
2004-03-19 23:02 ` Matthew Dobson
2004-03-20 0:59 ` Paul Jackson
2004-03-20 3:18 ` William Lee Irwin III
2004-03-20 6:09 ` Paul Jackson
2004-03-20 9:36 ` William Lee Irwin III
2004-03-22 23:59 ` Paul Jackson
2004-03-23 2:12 ` William Lee Irwin III
2004-03-23 1:21 ` Paul Jackson
2004-03-23 2:10 ` William Lee Irwin III
2004-03-23 1:24 ` Paul Jackson
2004-03-20 8:02 ` Paul Jackson
2004-03-20 11:13 ` William Lee Irwin III
2004-03-21 4:19 ` Paul Jackson
2004-03-21 4:36 ` William Lee Irwin III
2004-03-21 7:59 ` Nick Piggin
2004-03-23 1:12 ` Paul Jackson
2004-03-23 2:09 ` William Lee Irwin III
2004-03-23 2:39 ` Paul Jackson [this message]
2004-03-23 3:13 ` William Lee Irwin III
2004-03-23 3:36 ` Paul Jackson
2004-03-23 3:59 ` William Lee Irwin III
2004-03-23 4:03 ` Paul Jackson
[not found] ` <20040325012457.51f708c7.pj@sgi.com>
[not found] ` <20040325101827.GO791@holomorphy.com>
2004-03-26 22:36 ` Sparc64, cpumask_t and struct arguments (was: [PATCH] Introduce nodemask_t ADT) Paul Jackson
2004-03-26 22:54 ` David S. Miller
2004-03-26 23:18 ` Paul Jackson
2004-03-26 23:29 ` Paul Jackson
2004-03-27 0:08 ` David S. Miller
2004-03-27 0:50 ` Paul Jackson
2004-03-26 23:37 ` Paul Jackson
[not found] <1BeOx-7ax-55@gated-at.bofh.it>
[not found] ` <1BgGq-DU-5@gated-at.bofh.it>
[not found] ` <1BgZN-Vk-1@gated-at.bofh.it>
2004-03-19 2:04 ` [PATCH] Introduce nodemask_t ADT [0/7] Andi Kleen
2004-03-19 2:38 ` Paul Jackson
2004-03-19 23:09 ` Matthew Dobson
2004-03-20 0:47 ` Paul Jackson
2004-03-20 1:14 ` Paul Jackson
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=20040322183918.5e0f17c7.pj@sgi.com \
--to=pj@sgi.com \
--cc=akpm@osdl.org \
--cc=colpatch@us.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.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
Powered by JetHome