From: Jan Kara <jack@suse.cz>
To: Thavatchai Makphaibulchoke <thavatchai.makpahibulchoke@hp.com>
Cc: Jan Kara <jack@suse.cz>, T Makphaibulchoke <tmac@hp.com>,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH 0/2] ext4: Reduce contention on s_orphan_lock
Date: Tue, 6 May 2014 13:49:00 +0200 [thread overview]
Message-ID: <20140506114900.GF9291@quack.suse.cz> (raw)
In-Reply-To: <536414A8.2040506@hp.com>
On Fri 02-05-14 15:56:56, Thavatchai Makphaibulchoke wrote:
> On 04/29/2014 05:32 PM, Jan Kara wrote:
> >
> > Hello,
> >
> > so I finally got to looking into your patches for reducing contention
> > on s_orphan_lock. AFAICT these two patches (the first one is just a
> > small cleanup) should have the same speed gain as the patches you wrote
> > and they are simpler. Can you give them a try please? Thanks!
>
> I applied your patch and ran aim7 on both the 80 and 120 core count
> machines. There are aim7 workloads that your patch does show some
> performance improvement. Unfortunately in general, it does not have the
> same performance level as my original patch, especially with high user
> count, 500 or more.
Thanks for running the benchmarks!
> As for the hashed mutex used in my patch to serialize orphan operation
> within a single node, even if I agree with you that with existing code it
> is not required, I don't believe that you can count on that in the
> future. I believe that is also your concern, as you also added comment
> indicating the requirement of the i_mutex in your patch.
So I believe it is reasonable to require i_mutex to be held when orphan
operations are called. Adding / removing inode from orphan list is needed
when extending or truncating inode and these operations generally require
i_mutex in ext4. I've added the assertion so that we can catch a situation
when we either by mistake or intentionally grow a call site which won't
hold i_mutex. If such situation happens and we have good reasons why
i_mutex shouldn't be used there, then we can think about some dedicated
locks (either hashed or per inode ones).
> In terms of maintainability, I do not believe simply relying on warning
> in a comment is sufficient. On top of that with this new requirement, we
> are unnecessarily coupling the orphan operations to i_mutex, adding more
> contention to it. This would likely to cause performance regression, as
We aren't adding *any* contention. I didn't have to add a single
additional locking of i_mutex because in all the necessary cases we are
holding i_mutex over the orphan operations anyway (or the inode isn't
reachable by other processes). So regarding per-inode locking, we are doing
strictly less work with my patch than with your patch. However you are
correct in your comments to my patch 2/2 that in your patch you handle
operations under the global s_orphan_lock better and that's probably what
causes the difference. I need to improve that for sure.
> my experiment in responding to your earlier comment on my patch did show
> some regression when using i_mutex for serialization of orphan operations
> within a single node (adding code to lock the if it is not already
> locked).
>
> I still believe having a different mutex for orphan operation
> serialization is a better and safer alternative.
Frankly I don't see why they would be better. They are marginally safer
by keeping the locking inside the orphan functions but the WARN_ON I have
added pretty much mitigates this concern and as I wrote above I actually
think using i_mutex not only works but also makes logical sense.
> From my experiment so
> far (I'm still verifying this), it may even help improving the
> performance by spreading out the contention on the s_orphan_mutex.
So orphan operations on a single inode are serialized by i_mutex both
with your and with my patch. You add additional serialization by hashed
mutexes so now orphan operations for independent inodes get serialized as
well. It may in theory improve the performance by effectively making the
access to global s_orphan_lock less fair but for now I believe that other
differences in our patches is what makes a difference.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2014-05-06 11:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 23:32 [PATCH 0/2] ext4: Reduce contention on s_orphan_lock Jan Kara
2014-04-29 23:32 ` [PATCH 1/2] ext4: Use sbi in ext4_orphan_del() Jan Kara
2014-04-29 23:32 ` [PATCH 2/2] ext4: Reduce contention on s_orphan_lock Jan Kara
2014-05-02 21:56 ` Thavatchai Makphaibulchoke
2014-05-02 21:56 ` [PATCH 0/2] " Thavatchai Makphaibulchoke
2014-05-06 11:49 ` Jan Kara [this message]
2014-05-09 6:24 ` Thavatchai Makphaibulchoke
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=20140506114900.GF9291@quack.suse.cz \
--to=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=thavatchai.makpahibulchoke@hp.com \
--cc=tmac@hp.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).