Re: PCI Express support for 2.4 kernel

From: Kevin P. Fleming
Date: Mon Dec 15 2003 - 11:09:06 EST


Vladimir Kondratiev wrote:

To illustrate zero cost, I did the following test:
[tmp]$ cat t.c; gcc -S t.c; cat t.s
static int a1=0;
static int a2;
/* EOF */

.file "t.c"
.local a1
.comm a1,4,4
.local a2
.comm a2,4,4
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.3.1 20030811 (Red Hat Linux 3.3.1-1)"

As you can see, assembly code is identical, compiler did this trivial optimization for me.

You've missed the point, though. Initializing a static variable to zero causes space to be consumed in the resulting object file (not instruction code to be generated). This is wasted space, because if you don't initialize to zero the variable will be allocated out of space that is _automatically_ zeroed for you. This reduces the size of the kernel image by not filling it with unnecessary zeroes.

-
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/