Re: drivers/block/ub.c

From: David S. Miller
Date: Sat Jun 26 2004 - 18:23:23 EST


On Sun, 27 Jun 2004 00:36:14 +0200
Oliver Neukum <oliver@xxxxxxxxxx> wrote:

> So either it has no effect or it is needed?
> Then why take the risk that gcc is changed or an architecture added that
> needs it? It seems to be cleaner to me to mark data structures that
> must be layed out as specified specially. Safer, too, just in case.

Because it generates enormously inefficient code on RISC
platforms. It turns simple word loads like:

ld [%addr], %reg

into something like:

ldub [%addr + 0], %tmp1
ldub [%addr + 1], %tmp2
ldub [%addr + 2], %tmp3
ldub [%addr + 3], %tmp4
sll %tmp1, 24, %tmp1
sll %tmp2, 16, %tmp2
sll %tmp3, 8, %tmp3
or %tmp1, %tmp2, %tmp1
or %tmp1, %tmp3, %tmp1
or %tmp1, %tmp4, %reg

A ten-fold increase in code size just to access any member
of the structure.

I think you have no idea how astronomically inefficient the code is
which gets generated when you add the packed attribute to a structure.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/