cacheline aligned ?

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

 



Hi,
In softirq.c, statement
static struct softirq_action softirq_vec[32] __cacheline_aligned;


I am trying to figure out why this is cacheline_alligned.
I wrote a small piece of code to see how this may work ....

struct s {
    void (*action) (struct s *);
    int *data;
};

int main()
{
    int k;
    static struct s ss[32] __attribute__((__aligned__(32))) ;
    printf("first %x second %x \n",&ss[0],&ss[1]);
}

on executing this I get
first 80494e0 second 80494e8.
Which means the two elements of ss[] are 8 bytes apart. (ie sizeof struct s)

I achive the 32 byte alignment by modifing the code as below.
struct s {
    void (*action) (struct s *);
    int *data;
}__attribute__((__aligned__(32))) ;

and declaring
static struct s ss[32];

on executing I get
first 80494e0 second 8049500
ie 2 elemnts are 32 byte apart.

Please let me know what I am missing here.

Regards,
Rohit.
___________________________________________________
Art meets Army ; Swapna Weds Capt. Rajsekhar.
Rediff Matchmaker strikes another interesting match !!
Visit http://matchmaker.rediff.com?2


- : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux