results: Remove 8 bytes from struct page on 64bit archs

Anton Blanchard (anton@samba.org)
Mon, 7 Jan 2002 12:25:55 +1100



Hi,

> I'm curious to see how large the tradeoff is with calculating
> virtual in page_address(). The overhead there may be larger than
> the win we get from better cacheline footprint in struct page

Check out:

http://samba.org/~anton/linux/struct_page/

"struct page can be hazardous to your health"

On this machine (2 way power3) we see a ~5% improvement on dbench by
removing ->zone. Quite a nice improvement.

When we also remove ->virtual and use pointer arithmetic to do
page_address() performance drops back down. The reason for this can
be found in:

http://samba.org/~anton/linux/struct_page/2.4.18pre1-nopagezone-nopagevirtual/2/6.html

Search for divd, remembering the percentage to the left is shifted one
instruction down. Yes divides really hurt.

Basically the difference is:

page_address() using page->virtual:

ld 25,112(31)

page_address() using pointer arithmetic:

.LC1:
.quad mem_map
.LC2:
.quad 0xc000000000000000

...

ld 9,.LC1
li 11,120 ; sizeof(struct page)
ld 10,.LC2
ld 0,0(9)
subf 0,0,31
divd 0,0,11
sldi 0,0,12
add 25,0,10

Perhaps the compiler should be optimising this better (can we replace
the divide?)

Anton
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/