tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: in which we present an ugly hack to make sys/queue.h CIRCLEQ work



>I think it is actually 2 extra pointer deferences,

You're right, my apologies.

>but the important bit
>is that one of the pointers is fetched from memory you might not need to
>read from at all with a CIRCLEQ.  On modern processors one cache miss is
>worth a whole big pile of extra instructions, so doing reads from memory
>you don't strictly need to touch is about the easiest way to make things
>go slower.

I can understand that all, but still ... are people really using this in
ways it would be noticable?  If it was a serious issue, we could add the
extra previous element pointer you're talking about to the TAILQ macros
and it seems like that would do everything you want.

In a more practical sense ... it seems the only users of CIRCLEQ_PREV
are in sys/kern/subr_vmem.c and sys/kern/vfs_mount.c.  In a lot of the
ones in subr_vmem.c look like the relevant pointers would already be in
the cache (and they're only going back one element, not traversing the
whole list). vfs_mount.c uses in vfs_unmountall1().  CIRCLEQ_LAST is
only used by libform and also in vfs_mount.c.

--Ken


Home | Main Index | Thread Index | Old Index