mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Imran Khan <imran.f.khan@oracle.com>
To: Tejun Heo <tj@kernel.org>
Cc: gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernfs: Change kernfs_rwsem to a per-cpu rwsem.
Date: Sat, 25 Jun 2022 19:15:10 +1000	[thread overview]
Message-ID: <e6a78b3b-27ae-ade9-77a9-f8677e0850ea@oracle.com> (raw)
In-Reply-To: <YraLOZb2SnKl0wUO@mtj.duckdns.org>

Hello Tejun,

On 25/6/22 2:12 pm, Tejun Heo wrote:
> On Mon, Jun 20, 2022 at 01:26:34PM +1000, Imran Khan wrote:
>> On large systems when few hundred CPUs simulateously acquire kernfs_rwsem,
>> for reading we see performance degradation due to bouncing of cache line
>> that contains kernfs_rwsem. Changing kernfs_rwsem into a per-fs, per-cpu
>> rwsem can fix this degradation.
> ...
>> Moreover this run of 200 applications take more than 32 secs to finish on
>> this system.
>>
>> After changing kernfs_rwsem to a per-cpu rwsem, I can see that contention
>> for kernfs_rwsem is no longer visible in perf data and the test execution
>> time has reduced to almost half (17 secs or less from 32 secs or more).
>>
>> The overhead involving write operations with per-cpu rwsem will be higher
>> but frequency of creation/deletion of kernfs files is much less than
>> frequency at which kernfs (cgroup, sysfs) files are read.
> 
> The problem with percpu_rwsem is that write locking requires going
> through a RCU grace period, which can easily add two or more digit
> millisec latencies. I'm pretty sure there are code paths which are
> pretty heavy on write - e.g. during boot, depending on the machine
> configuration, we could be write-acquiring the rwsem hundreds of
> thousands of times and we'd be constantly doing RCU grace periods.
> 
> So, I don't think kernfs_rwsem is a good candidate for percpu rwsem.
> There likely are plenty of cases where write path isn't cold enough.
> 

Thanks for your feedback. I will continue with approach of hashed kernfs_rwsem then.

Thanks
-- Imran


      reply	other threads:[~2022-06-25  9:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  3:26 Imran Khan
2022-06-25  4:12 ` Tejun Heo
2022-06-25  9:15   ` Imran Khan [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=e6a78b3b-27ae-ade9-77a9-f8677e0850ea@oracle.com \
    --to=imran.f.khan@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®