From: Waiman Long <waiman.long@hp.com>
To: remaper <yp.fangdong@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Jeff Layton <jlayton@redhat.com>,
Miklos Szeredi <mszeredi@suse.cz>, Ian Kent <raven@themaw.net>,
Sage Weil <sage@inktank.com>, Steve French <sfrench@samba.org>,
Trond Myklebust <Trond.Myklebust@netapp.com>,
Eric Paris <eparis@redhat.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
autofs <autofs@vger.kernel.org>,
ceph-devel <ceph-devel@vger.kernel.org>,
linux-cifs <linux-cifs@vger.kernel.org>,
samba-technical <samba-technical@lists.samba.org>,
linux-nfs <linux-nfs@vger.kernel.org>,
"Chandramouleeswaran, Aswin" <aswin@hp.com>,
"Norton, Scott J" <scott.norton@hp.com>,
Andi Kleen <andi@firstfloor.org>,
Dave Chinner <david@fromorbit.com>
Subject: Re: =?gb18030?Q?=BB=D8=B8=B4=A3=BA=5BPATCH_1/3_v3=5D_dcache=3A_Don=27t_take_unnecessary_lock_in_d=5Fcount_update?=
Date: Thu, 23 May 2013 16:51:47 -0400 [thread overview]
Message-ID: <519E8163.8070402@hp.com> (raw)
In-Reply-To: <tencent_6519A7723A666F8378EE1517@qq.com>
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
prev parent reply other threads:[~2013-05-23 20:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 9:09 =?gb18030?B?u9i4tKO6W1BBVENIIDEvMyB2M10gZGNhY2hlOiBEb24ndCB0YWtlIHVubmVjZXNzYXJ5IGxvY2sgaW4gZF9jb3VudCB1cGRhdGU=?= =?gb18030?B?cmVtYXBlcg==?=
2013-05-23 20:51 ` Waiman Long [this message]
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=519E8163.8070402@hp.com \
--to=waiman.long@hp.com \
--cc=Trond.Myklebust@netapp.com \
--cc=andi@firstfloor.org \
--cc=aswin@hp.com \
--cc=autofs@vger.kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=david@fromorbit.com \
--cc=eparis@redhat.com \
--cc=jlayton@redhat.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=mszeredi@suse.cz \
--cc=raven@themaw.net \
--cc=sage@inktank.com \
--cc=samba-technical@lists.samba.org \
--cc=scott.norton@hp.com \
--cc=sfrench@samba.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yp.fangdong@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).