Re: [PATCH] fs: pipe/sockets/anon dentries should have themselves as parent

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Saturday, November 22, 2008 - 8:53 pm

Matthew Wilcox a =E9crit :

Yes, no problem, better to have the same order.

ent
e)
D
y

Yes, this is better.


Well, I personally prefer the two lines, intention is more readable :)


Thanks Matthew, here is an updated version of the patch.

[PATCH] fs: pipe/sockets/anon dentries should have themselves as parent


Linking pipe/sockets/anon dentries to one root 'parent' has no functional=

impact at all, but a scalability one.

We can avoid touching a cache line at allocation stage (inside d_alloc(),=
 no need
to touch root->d_count), but also at freeing time (in d_kill, decrementin=
g d_count)
We avoid an expensive atomic_dec_and_lock() call on the root dentry.

We add d_alloc_unhashed(const char *name, struct inode *inode) helper
to be used by pipes/socket/anon. This function is about the same as
d_alloc_root() but for unhashed entries.

Before patch, time to run 8 *  1 million of close(socket()) calls on 8 CP=
US was :

real    0m27.496s
user    0m0.657s
sys     3m39.092s

After patch :

real    0m23.843s
user    0m0.616s
sys     3m9.732s


Old oprofile :
CPU: Core 2, speed 3000.11 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a uni=
t mask of 0x00 (Unhalted core cycles) count 100000
samples  cum. samples  %        cum. %     symbol name
164257   164257        11.0245  11.0245    init_file
155488   319745        10.4359  21.4604    d_alloc
151887   471632        10.1942  31.6547    _atomic_dec_and_lock
91620    563252         6.1493  37.8039    inet_create
74245    637497         4.9831  42.7871    kmem_cache_alloc
46702    684199         3.1345  45.9216    dentry_iput
46186    730385         3.0999  49.0215    tcp_close
42824    773209         2.8742  51.8957    kmem_cache_free
37275    810484         2.5018  54.3975    wake_up_inode
36553    847037         2.4533  56.8508    tcp_v4_init_sock
35661    882698         2.3935  59.2443    inotify_d_instantiate
32998    915696         2.2147  61.4590    sysenter_past_esp
31442    947138         2.1103  63.5693    d_instantiate
31303    978441         2.1010  65.6703    generic_forget_inode
27533    1005974        1.8479  67.5183    vfs_dq_drop
24237    1030211        1.6267  69.1450    sock_attach_fd
19290    1049501        1.2947  70.4397    __copy_from_user_ll


New oprofile :
CPU: Core 2, speed 3000.11 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a uni=
t mask of 0x00 (Unhalted core cycles) count 100000
samples  cum. samples  %        cum. %     symbol name
148703   148703        10.8581  10.8581    inet_create
116680   265383         8.5198  19.3779    new_inode
108912   374295         7.9526  27.3306    init_file
82911    457206         6.0541  33.3846    kmem_cache_alloc
65690    522896         4.7966  38.1812    wake_up_inode
53286    576182         3.8909  42.0721    _atomic_dec_and_lock
43814    619996         3.1992  45.2713    generic_forget_inode
41993    661989         3.0663  48.3376    d_alloc
41244    703233         3.0116  51.3492    kmem_cache_free
39244    742477         2.8655  54.2148    tcp_v4_init_sock
37402    779879         2.7310  56.9458    tcp_close
33336    813215         2.4342  59.3800    sysenter_past_esp
28596    841811         2.0880  61.4680    inode_has_buffers
25769    867580         1.8816  63.3496    d_kill
22606    890186         1.6507  65.0003    dentry_iput
20224    910410         1.4767  66.4770    vfs_dq_drop
19800    930210         1.4458  67.9228    __copy_from_user_ll

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
---
 fs/anon_inodes.c       |    9 +--------
 fs/dcache.c            |   33 +++++++++++++++++++++++++++++++++
 fs/pipe.c              |   10 +---------
 include/linux/dcache.h |    1 +
 net/socket.c           |   10 +---------
 5 files changed, 37 insertions(+), 26 deletions(-)
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] fs: pipe/sockets/anon dentries should not have ..., Christoph Hellwig, (Fri Nov 21, 8:36 am)
Re: [PATCH] fs: pipe/sockets/anon dentries should have the ..., Eric Dumazet, (Sat Nov 22, 8:53 pm)
[PATCH 1/6] fs: Introduce a per_cpu nr_dentry, Eric Dumazet, (Wed Nov 26, 4:30 pm)
[PATCH 3/6] fs: Introduce a per_cpu last_ino allocator, Eric Dumazet, (Wed Nov 26, 4:32 pm)
[PATCH 4/6] fs: Introduce a per_cpu nr_inodes, Eric Dumazet, (Wed Nov 26, 4:32 pm)
[PATCH 5/6] fs: Introduce special inodes, Eric Dumazet, (Wed Nov 26, 4:32 pm)
Re: [PATCH 0/6] fs: Scalability of sockets/pipes allocatio ..., Christoph Lameter, (Wed Nov 26, 6:37 pm)
Re: [PATCH 5/6] fs: Introduce special inodes, David Miller, (Thu Nov 27, 1:20 am)
Re: [PATCH 4/6] fs: Introduce a per_cpu nr_inodes, Peter Zijlstra, (Thu Nov 27, 2:32 am)
Re: [PATCH 4/6] fs: Introduce a per_cpu nr_inodes, Peter Zijlstra, (Thu Nov 27, 2:39 am)
Re: [PATCH 0/6] fs: Scalability of sockets/pipes allocatio ..., Christoph Hellwig, (Thu Nov 27, 2:39 am)
Re: [PATCH 1/6] fs: Introduce a per_cpu nr_dentry, Christoph Hellwig, (Thu Nov 27, 2:41 am)
Re: [PATCH 3/6] fs: Introduce a per_cpu last_ino allocator, Christoph Hellwig, (Thu Nov 27, 2:46 am)
Re: [PATCH 4/6] fs: Introduce a per_cpu nr_inodes, Christoph Hellwig, (Thu Nov 27, 2:48 am)
Re: [PATCH 6/6] fs: Introduce kern_mount_special() to moun ..., Christoph Hellwig, (Thu Nov 27, 2:53 am)
Re: [PATCH 4/6] fs: Introduce a per_cpu nr_inodes, Eric Dumazet, (Thu Nov 27, 3:01 am)
Re: [PATCH 4/6] fs: Introduce a per_cpu nr_inodes, Andi Kleen, (Thu Nov 27, 3:07 am)
Re: [PATCH 6/6] fs: Introduce kern_mount_special() to moun ..., Christoph Hellwig, (Thu Nov 27, 3:10 am)
Re: [PATCH 0/6] fs: Scalability of sockets/pipes allocatio ..., Christoph Lameter, (Thu Nov 27, 7:44 am)
Re: [PATCH 4/6] fs: Introduce a per_cpu nr_inodes, Christoph Lameter, (Thu Nov 27, 7:46 am)
Re: [PATCH 0/6] fs: Scalability of sockets/pipes allocatio ..., Christoph Hellwig, (Fri Nov 28, 11:38 pm)
[PATCH v2 5/5] fs: new_inode_single() and iput_single(), Eric Dumazet, (Sat Nov 29, 1:45 am)
[PATCH v3 5/7] fs: new_inode_single() and iput_single(), Eric Dumazet, (Thu Dec 11, 3:40 pm)
[PATCH v3 7/7] fs: MS_NOREFCOUNT, Eric Dumazet, (Thu Dec 11, 3:41 pm)
Re: [PATCH v3 6/7] fs: struct file move from call_rcu() to ..., Christoph Lameter, (Fri Dec 12, 6:41 pm)
Re: [PATCH v3 6/7] fs: struct file move from call_rcu() to ..., Christoph Lameter, (Fri Dec 12, 7:07 pm)
Re: [PATCH v3 3/7] fs: Introduce a per_cpu last_ino allocator, Paul E. McKenney, (Tue Dec 16, 2:26 pm)
Re: [PATCH v3 5/7] fs: new_inode_single() and iput_single(), Paul E. McKenney, (Tue Dec 16, 2:41 pm)