public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patchset] Lockfree fd lookup 0 of 5
@ 2004-08-02 10:10 Ravikiran G Thirumalai
  2004-08-02 10:13 ` [patchset] Lockfree fd lookup 1 " Ravikiran G Thirumalai
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Ravikiran G Thirumalai @ 2004-08-02 10:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Greg KH, dipankar, viro

Here is a patchset to eliminate taking struct files_struct.file_lock on 
reader side using rcu and rcu based refcounting.  These patches
extend the kref api to include kref_lf_xxx api and kref_lf_get_rcu to
do lockfree refcounting, and use the same.  As posted earlier, since fd
lookups (struct files_struct.fd[]) will be lock free with these patches, 
threaded workloads doing lots of io should see performance benefits 
due to this patchset.  I have observed 13-15% improvement with tiobench 
on a 4 way xeon with this patchset.

The patchset contains:
1. kref-merged-2.6.7.patch -- kref shrinkage patch which GregKH has applied to
   his tree.
2. kref-drivers-2.6.7.patch -- existing users of kref modified to use the
   'shrunk' krefs.  GregKH has applied this to his tree too
3. kref-lf-2.6.7.patch -- kref api additions for lock free refcounting.  
   This patch relocates kref api to kref.h as static inlines since they
   are mostly wrappers around atomic_xxx operations
4. files_struct-kref-s-2.6.7.patch -- change struct file.f_count to a kref
   and use kref api for refcounting.  This does not add any performance
   benefit and is just an intermediate patch
5. files_struct-rcu-kref-2.6.7.patch -- Make fd lookups lock free by using
   rcu and kref_lf_xxx api for lockfree refcounting

The patchset will follow this post.

Thanks,
Kiran


^ permalink raw reply	[flat|nested] 23+ messages in thread
* Re: [patchset] Lockfree fd lookup 0 of 5
@ 2004-08-02 18:50 Manfred Spraul
  0 siblings, 0 replies; 23+ messages in thread
From: Manfred Spraul @ 2004-08-02 18:50 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, Ravikiran G Thirumalai

viro wrote:

>How about this for comparison?  That's just a dumb "convert to rwlock"
>patch; we can be smarter in e.g. close_on_exec handling, but that's a
>separate story.
>  
>
That won't help:
The problem is the cache line trashing from fget() and fget_light() with 
multithreaded apps. A sequence lock might help, but an rw lock is not a 
solution.
Actually: 2.4 had an rwlock, it was converted to a spinlock because 
spinlocks are faster on i386:

    read_lock();
    short operation();
    read_unlock();

is a bit slower than

    spin_lock();
    short operation();
    spin_unlock();

because read_unlock() is a full memory barrier and spin_unlock is not a 
memory barrier (not necessary because writes are ordered)

--
    Manfred

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2004-08-03 10:21 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-02 10:10 [patchset] Lockfree fd lookup 0 of 5 Ravikiran G Thirumalai
2004-08-02 10:13 ` [patchset] Lockfree fd lookup 1 " Ravikiran G Thirumalai
2004-08-02 13:38   ` Christoph Hellwig
2004-08-02 16:12     ` viro
2004-08-03  0:44   ` Greg KH
2004-08-02 10:16 ` [patchset] Lockfree fd lookup 2 " Ravikiran G Thirumalai
2004-08-03  0:43   ` Greg KH
2004-08-03  6:28     ` Ravikiran G Thirumalai
2004-08-03  6:44   ` Greg KH
2004-08-03  7:41     ` Ravikiran G Thirumalai
2004-08-02 10:18 ` [patchset] Lockfree fd lookup 0 " Ravikiran G Thirumalai
2004-08-02 10:20 ` [patchset] Lockfree fd lookup 4 " Ravikiran G Thirumalai
2004-08-02 10:23 ` [patchset] Lockfree fd lookup 5 " Ravikiran G Thirumalai
2004-08-02 16:56 ` [patchset] Lockfree fd lookup 0 " viro
2004-08-02 20:07   ` David S. Miller
2004-08-02 21:01     ` William Lee Irwin III
2004-08-02 23:15       ` David S. Miller
2004-08-03  2:04         ` William Lee Irwin III
2004-08-03  9:23   ` Ravikiran G Thirumalai
2004-08-03  9:35     ` Ravikiran G Thirumalai
2004-08-03 10:17       ` Dipankar Sarma
2004-08-03 10:06     ` viro
  -- strict thread matches above, loose matches on Subject: below --
2004-08-02 18:50 Manfred Spraul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox