DragonFly commits List (threaded) for 2009-04
Re: DragonFly-220.127.116.118.gd7215 master sys/dev/netif/emx if_emx.h
Sepherosa Ziehau wrote:
On Wed, Apr 29, 2009 at 9:42 AM, Matthew Dillon
:Yeah. However, could you tell me the major reason you want to put
:__cachealign in struct field? I guess you worried about emx_rxdata
:being used outside of emx_softc?
It's more obvious that the array needs to be cache-aligned if it is
in the softc structure. Also, it's more C-like. Putting storage
attributes on structural definitions is not very C-like. The storage
attributes should be on declarations instead.
Mmm, setting __cachealign on struct field (i.e. in emx_softc) does not
achieve what I want here: I want the struct's size to be (N *
cacheline_size) in addition to be cacheline_size aligned. So in
ifpoll, CPU0's writing to rx_data will not pollute rx_data's
cache in CPU1.
Right. Every array element needs to be cache aligned, not only the array by itself.