From: Eric Dumazet <dada1@cosmosbay.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ulrich Drepper <drepper@redhat.com>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [patch 1/8] fdmap v2 - fdmap core
Date: Fri, 08 Jun 2007 06:54:30 +0200 [thread overview]
Message-ID: <4668E106.9040509@cosmosbay.com> (raw)
In-Reply-To: <send-serie.davidel@xmailserver.org.4625.1181169031.1>
Davide Libenzi a écrit :
> +struct fd_map {
> + struct fd_map *next;
> + struct rcu_head rcu;
> + unsigned int base;
> + unsigned int size;
> + struct list_head slist;
> + struct list_head *slots;
> + unsigned int fdnext;
> + unsigned long *map;
> + void (*freecb)(void *, struct fd_map *);
> + void *freecb_priv;
> +};
On x86_64 that would mean folowing offsets
struct fd_map {
struct fd_map *next; /* 0 */
struct rcu_head rcu; /* 8 */
unsigned int base; /* 0x18 */
unsigned int size; /* 0x1c */
struct list_head slist; /* 0x20 */
struct list_head *slots; /* 0x30 */
unsigned int fdnext; /* 0x38 */
unsigned long *map; /* 0x40 */
void (*freecb)(void *, struct fd_map *); /* 0x48 */
void *freecb_priv; /* 0x50 */
}; /* size 0x58 */
As L1_CACHE_BYTES is 64, two cache lines are necessary to get base,size,map
And a change of fdnext dirties one cache line that should be kept read only to
avoid false sharing.
I suggest to reorder to move rcu and next at the end (since they are seldom
used). Also move fdnext on a separate cache line on SMP
struct fd_map {
/*
* read mostly part
*/
unsigned int base; /* 0x00 */
unsigned int size; /* 0x04 */
struct list_head slist; /* 0x08 */
struct list_head *slots; /* 0x18 */
unsigned long *map; /* 0x28 */
void (*freecb)(void *, struct fd_map *); /* 0x30 */
void *freecb_priv; /* 0x38 */
/*
* written part on a separate cache line in SMP
*/
unsigned int fdnext ____cacheline_aligned_in_smp; /* 0x40 */
struct fd_map *next; /* 0x48 */
struct rcu_head rcu; /* 0x50 */
};
Thank you
next prev parent reply other threads:[~2007-06-08 4:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-06 22:30 [patch 1/8] fdmap v2 - fdmap core Davide Libenzi
2007-06-07 6:54 ` Eric Dumazet
2007-06-07 7:10 ` Davide Libenzi
2007-06-07 10:39 ` [patch 7/8] fdmap v2 - implement sys_socket2 Eric Dumazet
2007-06-07 15:42 ` Davide Libenzi
2007-06-08 4:54 ` Eric Dumazet [this message]
2007-06-08 5:00 ` [patch 1/8] fdmap v2 - fdmap core Eric Dumazet
2007-06-08 5:22 ` Davide Libenzi
2007-06-08 5:25 ` Davide Libenzi
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=4668E106.9040509@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@linux-foundation.org \
--cc=davidel@xmailserver.org \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.