Skip to contentSkip to conversation

Large inlines in include/linux/skbuff.h

DISCUSSION Andi Kleen 4 participants 9 messages Apr 22, 2004 5 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#2 lore raw
Quoted 7 lines · James Morris
Quoted 2 lines · Denis Vlasenko

What shall be done with this? I'll make patch to move locking functions into net/core/skbuff.c unless there is some reason not to do it.

How will these changes impact performance? I asked this last time you posted about inlines and didn't see any response.

I don't think it will be an issue. The optimization guidelines of AMD and Intel recommend to move functions that generate more than 30-40 instructions out of line. 100 instructions is certainly enough to amortize the call overhead, and you safe some icache too so it may be even faster.

-Andi

#3 lore raw
Quoted 8 lines · Andi Kleen
Quoted 2 lines

How will these changes impact performance? I asked this last time you posted about inlines and didn't see any response.

I don't think it will be an issue. The optimization guidelines of AMD and Intel recommend to move functions that generate more than 30-40 instructions out of line. 100 instructions is certainly enough to amortize the call overhead, and you safe some icache too so it may be even faster.

Of course, but it would be good to see some measurements.

- James

Signature · 2 lines
James Morris
<[email protected]>
#4 lore raw
Quoted 12 lines · James Morris
Quoted 7 lines · Andi Kleen
Quoted 3 lines

How will these changes impact performance? I asked this last time you posted about inlines and didn't see any response.

I don't think it will be an issue. The optimization guidelines
of AMD and Intel recommend to move functions that generate more than 30-40 instructions out of line. 100 instructions is certainly enough to amortize the call overhead, and you safe some icache too so it may be even faster.

Quoted 6 lines

Of course, but it would be good to see some measurements.

- James

It depends a lot of the workload of the machine.

If this a specialized machine, with a small program that mostly uses recv() & send() syscalls, then, inlining functions is a gain, since icache may have a 100% hit ratio. Optimization guidelines are good for the common cases, not every cases.

Eric Dumazet

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 9 lines · Denis Vlasenko
Quoted 8 lines

If this a specialized machine, with a small program that mostly uses recv() & send() syscalls, then, inlining functions is a gain, since icache may have a 100% hit ratio. Optimization guidelines are good for the common cases, not every cases.

Quoted 7 lines

And if it is NOT a specialized machine? icache miss will nullify any speed advantages, while you still pay space penalty. We don't need to pay for at least ~250 kbytes wasted overall in allyesconfig kernel for each and every specialized setup conceivable, IMHO.

The point is : if this IS a specialized machine, then the kernel is custom one, not allyesconfig.

This is imho what I do for specialized machines, and yes, I even inline some specific functions, like fget() and others.

But I didnt asked to not doing the un-inlining, I was just reminding that some guys (like me) are doing micro-optimizations that 'seem' to go against Optimizations guidelines from intel or AMD.

Eric

author
#7 lore raw
In reply to James Morris
Quoted 5 lines · James Morris
Quoted 3 lines · Andi Kleen
Quoted 2 lines

How will these changes impact performance? I asked this last time you posted about inlines and didn't see any response.

Quoted 7 lines
Quoted 5 lines

I don't think it will be an issue. The optimization guidelines of AMD and Intel recommend to move functions that generate more than 30-40 instructions out of line. 100 instructions is certainly enough to amortize the call overhead, and you safe some icache too so it may be even faster.

Of course, but it would be good to see some measurements.

It's useless in this case. networking is dominated by cache misses and locks and a modern CPU can do hundreds of function calls in a single cache miss.

-Andi

#8 lore raw
Quoted 5 lines · On 23 Apr 2004 00:23:26 +0200 Andi Kleen <[email protected]> wrote:
Quoted 1 line

Of course, but it would be good to see some measurements.

It's useless in this case. networking is dominated by cache misses and locks and a modern CPU can do hundreds of function calls in a single cache miss.

Indeed, this change does influence the I-cache footprint of the networking, so I conclude that it is relevant in this case.

author
#9 lore raw
Quoted 11 lines · David S. Miller
Quoted 5 lines · On 23 Apr 2004 00:23:26 +0200 Andi Kleen <[email protected]> wrote:
Quoted 1 line

Of course, but it would be good to see some measurements.

It's useless in this case. networking is dominated by cache misses and locks and a modern CPU can do hundreds of function calls in a single cache miss.

Indeed, this change does influence the I-cache footprint of the networking, so I conclude that it is relevant in this case.

All it does it is to lower the cache foot print, not enlarge it. So even if it made a difference it could only get better. It's extremly unlikely to make it detectable worse.

-Andi

#10 lore raw
Quoted 3 lines · On 23 Apr 2004 00:34:01 +0200 Andi Kleen <[email protected]> wrote:

All it does it is to lower the cache foot print, not enlarge it. So even if it made a difference it could only get better. It's extremly unlikely to make it detectable worse.

That's a good argument. I would still like to see some numbers, you know to help me sleep at night :-)

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#13 lore raw
Quoted 4 lines · David S. Miller

He's asking you to test and quantify the performance changes that occur as a result of this patch, not to figure it out via calculations in your head :-)

I bet it will be completely unnoticeable in macrobenchmarks.

The only way to measure a difference would be likely to use some unrealistic microbenchmark (program that calls this in a tight loop)

-Andi