[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <519E8163.8070402@hp.com>
Date: Thu, 23 May 2013 16:51:47 -0400
From: Waiman Long <waiman.long@...com>
To: remaper <yp.fangdong@...il.com>
CC: Alexander Viro <viro@...iv.linux.org.uk>,
Jeff Layton <jlayton@...hat.com>,
Miklos Szeredi <mszeredi@...e.cz>, Ian Kent <raven@...maw.net>,
Sage Weil <sage@...tank.com>, Steve French <sfrench@...ba.org>,
Trond Myklebust <Trond.Myklebust@...app.com>,
Eric Paris <eparis@...hat.com>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
autofs <autofs@...r.kernel.org>,
ceph-devel <ceph-devel@...r.kernel.org>,
linux-cifs <linux-cifs@...r.kernel.org>,
samba-technical <samba-technical@...ts.samba.org>,
linux-nfs <linux-nfs@...r.kernel.org>,
"Chandramouleeswaran, Aswin" <aswin@...com>,
"Norton, Scott J" <scott.norton@...com>,
Andi Kleen <andi@...stfloor.org>,
Dave Chinner <david@...morbit.com>
Subject: Re: 回复:[PATCH 1/3 v3] dcache: Don't take unnecessary lock in d_count update
On 05/23/2013 05:09 AM, remaper wrote:
> maybe you can use the atomic_dec_and_lock(&dentry->d_count,&dentry->d_lock) here, right ?
>
> ------------------ Origin ------------------
>> The current code takes the dentry's d_lock lock whenever the d_count
>> reference count is being updated. In reality, nothing big really
>> happens until d_count goes to 0 in dput(). So it is not necessary to
>> take the lock if the reference count won't go to 0.
Thank for the suggestion.
First of all, the d_count field is not an atomic type. Changing it to
atomic will require touching quite a large number of source files even
though that change won't change the size of the dentry. Secondly, the
function internally uses cmpxchg to do its work. There isn't any
performance advantage of using it. I also need the count to go in both
direction, not just going down.
Regards,
Longman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists