All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dipankar Sarma <dipankar@in.ibm.com>
To: Eric Dumazet <dada1@cosmosbay.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 04:20:43 +0530	[thread overview]
Message-ID: <20050914225043.GD6237@in.ibm.com> (raw)
In-Reply-To: <4328A73B.1080801@cosmosbay.com>

On Thu, Sep 15, 2005 at 12:42:03AM +0200, Eric Dumazet wrote:
> Dipankar Sarma a écrit :
> >On Wed, Sep 14, 2005 at 11:17:42PM +0200, Eric Dumazet wrote:
> >
> >>--- linux-2.6.14-rc1/include/linux/file.h	2005-09-13 
> >>05:12:09.000000000 +0200
> >>+++ linux-2.6.14-rc1-ed/include/linux/file.h	2005-09-15 
> >>01:09:13.000000000 +0200
> >>@@ -34,12 +34,12 @@
> >> */
> >>struct files_struct {
> >>        atomic_t count;
> >>-        spinlock_t file_lock;     /* Protects all the below members.  
> >>Nests inside tsk->alloc_lock */
> >>	struct fdtable *fdt;
> >>	struct fdtable fdtab;
> >>        fd_set close_on_exec_init;
> >>        fd_set open_fds_init;
> >>        struct file * fd_array[NR_OPEN_DEFAULT];
> >>+	spinlock_t file_lock;     /* Protects concurrent writers.  Nests 
> >>inside tsk->alloc_lock */
> >>};
> >>
> >>#define files_fdtable(files) (rcu_dereference((files)->fdt))
> >
> >
> >For most apps without too many open fds, the embedded fd_sets
> >are going to be used. Wouldn't that mean that open()/close() will
> >invalidate the cache line containing fdt, fdtab by updating
> >the fd_sets ? If so, you optimization really doesn't help.
> >
> 
> If the embedded struct fdtable is used, then the only touched field is 
> 'next_fd', so we could also move this field at the end of 'struct fdtable'
> 

Not just embedded fdtable, but also the embedded fdsets. I would expect
count, fdt, fdtab and the fdsets to fit into one cache line in 
some archs.


> But I wonder if 'next_fd' really has to be in 'struct fdtable', maybe it 
> could be moved to 'struct files_struct' close to file_lock ?

next_fd has to be in struct fdtable. It needs to be consistent
with whichever fdtable a lock-free reader sees.

> 
> 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.

Some benchmarking would be useful here.

Thanks
Dipankar

  reply	other threads:[~2005-09-14 22:57 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 [this message]
2005-09-14 23:19                 ` Eric Dumazet
2005-09-15  4:54                   ` Dipankar Sarma
2005-09-15  6:17                     ` Eric Dumazet
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=20050914225043.GD6237@in.ibm.com \
    --to=dipankar@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --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 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.