Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Laurent Chavey <chavey@google.com>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC] change dst_entry padding from using an array to using __attribute__
Date: Wed, 07 Apr 2010 18:55:29 +0200	[thread overview]
Message-ID: <1270659329.8141.40.camel@edumazet-laptop> (raw)
In-Reply-To: <t2o97949e3e1004070946mfacef7c0la6bddc38d29720ae@mail.gmail.com>

Le mercredi 07 avril 2010 à 09:46 -0700, Laurent Chavey a écrit :
> what are the benefit(s)  of using an array to force a struct
> element to be aligned on 64 bytes / 32 bytes boundaries
> versus using gcc __attribute__.
> 
> 
> ------------------------------------
> 
> struct dst_entry {
> 
>        /*
>         * Align __refcnt to a 64 bytes alignment
>         * (L1_CACHE_SIZE would be too much)
>         */
> - #ifdef CONFIG_64BIT
> -       long                    __pad_to_align_refcnt[1];
> - #else
> -       long                    __pad_to_align_refcnt[0];
> - #endif
> +       atomic_t                __refcnt __attribute__
> ((aligned(64))); /* client references    */
> #undef __padding__
>        /*
>         * __refcnt wants to be on a different cache line from
>         * input/output/ops or performance tanks badly
>         */
>        atomic_t                __refcnt;       /* client references    */
> };

We dont want a huge hole (say.. 120 bytes) being not noticed.

Some machines around have 4 millions dst entries.

This deserve us being not lazy :)

Thanks



  reply	other threads:[~2010-04-07 16:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 16:46 [RFC] change dst_entry padding from using an array to using __attribute__ Laurent Chavey
2010-04-07 16:55 ` Eric Dumazet [this message]
2010-04-07 16:56   ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1270659329.8141.40.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=chavey@google.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox