On Sun, Oct 18, 2020 at 09:49:51AM -0700, Jakub Kicinski wrote:
> > +   struct u64_stats_sync   syncp;
> > +} __aligned(1 * sizeof(u64));
> 
> Why aligned to u64? Compiler should pick a reasonable alignment here 
> by itself.

Hi Jakub

I wondered that as well. But:

struct gnet_stats_basic_cpu {
        struct gnet_stats_basic_packed bstats;
        struct u64_stats_sync syncp;
} __aligned(2 * sizeof(u64));

/* often modified stats are per-CPU, other are shared (netdev->stats) */
struct pcpu_sw_netstats {
        u64     rx_packets;
        u64     rx_bytes;
        u64     tx_packets;
        u64     tx_bytes;
        struct u64_stats_sync   syncp;
} __aligned(4 * sizeof(u64));

struct pcpu_lstats {
        u64_stats_t packets;
        u64_stats_t bytes;
        struct u64_stats_sync syncp;
} __aligned(2 * sizeof(u64));

Cargo cult or is there a real need?

      Andrew

Reply via email to