Skip to contentSkip to conversation

TLB addend field

Qemu-devel Theodore Dubois 2 participants 2 messages Jun 21, 2017

lore
Share & tools
lore
#0 lore raw

Hi, I’ve got a question about the addend field in the TLB. Why use this instead of a pointer to the host page? I would think the speed difference would be unmeasurable.

~Theodore

#1 lore raw
Quoted 3 lines · Theodore Dubois

Hi, I’ve got a question about the addend field in the TLB. Why use this instead of a pointer to the host page? I would think the speed difference would be unmeasurable.

After the TLB check you have computed "x & ~(PAGE_SIZE - 1)", but not "x & (PAGE_SIZE - 1)". Without the addend field you would need an extra instruction for the latter and you would have more complicated register allocations. It would probably be small but measurable. If you think it simplifies the code and it is not measurable, do it and send a patch! :)

Paolo