From: Eric Dumazet <dada1@cosmosbay.com>
To: dipankar@in.ibm.com
Cc: "David S. Miller" <davem@davemloft.net>,
linux-kernel@vger.kernel.org, torvalds@osdl.org, akpm@osdl.org
Subject: Re: [PATCH] reorder struct files_struct
Date: Thu, 15 Sep 2005 08:17:40 +0200 [thread overview]
Message-ID: <43291204.9060208@cosmosbay.com> (raw)
In-Reply-To: <20050915045440.GE6237@in.ibm.com>
Dipankar Sarma a écrit :
> On Thu, Sep 15, 2005 at 01:19:47AM +0200, Eric Dumazet wrote:
>
>>Dipankar Sarma a écrit :
>>
>>>On Thu, Sep 15, 2005 at 12:42:03AM +0200, Eric Dumazet wrote:
>>>
>>>
>>>>Dipankar Sarma a écrit :
>>
>>>>If yes, the whole embedded struct fdtable is readonly.
>>>
>>>
>>>But not close_on_exec_init or open_fds_init. We would update them
>>>on open/close.
>>
>>Yes, sure, but those fields are not part of the embedded struct fdtable
>
>
> Those fdsets would share a cache line with fdt, fdtable which would
> be invalidated on open/close. So, what is the point in moving
> file_lock ?
>
The point is that we gain nothing in this case for 32 bits platforms, but we
gain something on 64 bits platform. And for apps using more than
NR_OPEN_DEFAULT files we definitly win on both 32bits/64bits.
Maybe moving file_lock just before close_on_exec_init would be a better
choice, so that 32bits platform small apps touch one cache line instead of two.
sizeof(struct fdtable) = 40/0x28 on 32bits, 72/0x48 on 64 bits
struct files_struct {
/* mostly read */
atomic_t count; /* offset 0x00 */
struct fdtable *fdt; /* offset 0x04 (0x08 on 64 bits) */
struct fdtable fdtab; /* offset 0x08 (0x10 on 64 bits)*/
/* read/written for apps using small number of files */
fd_set close_on_exec_init; /* offset 0x30 (0x58 on 64 bits) */
fd_set open_fds_init; /* offset 0x34 (0x60 on 64 bits) */
struct file * fd_array[NR_OPEN_DEFAULT]; /* offset 0x38 (0x68 on 64 bits */
spinlock_t file_lock; /* 0xB8 (0x268 on 64 bits) */
}; /* size = 0xBC (0x270 on 64 bits) */
Moving next_fd from 'struct fdtable' to 'struct files_struct' is also a win
for 64bits platforms since sizeof(struct fdtable) become 64 : a nice power of
two, so 64 bytes are allocated instead of 128.
Eric
next prev parent reply other threads:[~2005-09-15 6:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-14 18:31 [PATCH]: Brown paper bag in fs/file.c? David S. Miller
2005-09-14 18:48 ` David S. Miller
2005-09-14 19:05 ` David S. Miller
2005-09-14 19:18 ` Dipankar Sarma
2005-09-14 19:57 ` David S. Miller
2005-09-14 20:15 ` Dipankar Sarma
2005-09-14 20:29 ` David S. Miller
2005-09-14 21:17 ` [PATCH] reorder struct files_struct Eric Dumazet
2005-09-14 21:35 ` Peter Staubach
2005-09-14 22:02 ` Dipankar Sarma
2005-09-14 22:17 ` Andrew Morton
2005-09-14 22:42 ` Eric Dumazet
2005-09-14 22:50 ` Dipankar Sarma
2005-09-14 23:19 ` Eric Dumazet
2005-09-15 4:54 ` Dipankar Sarma
2005-09-15 6:17 ` Eric Dumazet [this message]
2005-09-15 9:35 ` Dipankar Sarma
2005-09-15 17:11 ` Eric Dumazet
2005-09-15 21:06 ` [PATCH]: Brown paper bag in fs/file.c? David S. Miller
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=43291204.9060208@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@osdl.org \
--cc=davem@davemloft.net \
--cc=dipankar@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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