This percpu_rwsem that always enters its reader slow path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello friends,

Just providing an update on my debugging of percpu_rwsem (related to
rcu-sync) for the day! which I pinged Byungchul about. Please ignore
this email if you are busy :) I am just archiving it in here..

As you may know, percpu_rwsem uses rcu-sync framework to reduce cost
of read-side by making it free of any serializing/atomic instructions
at all. However, there was one sempahore which broke the rules!

I spent a couple hours trying to figure out why
cgroup_threadgroup_rwsem always entered the reader-slow path on my
system (RCU-sync turns out to be non-idle for this rwsem). I really
thought it was a bug, because I felt what's the pointed of rcu-sync if
it never goes idle..

Then I landed on the commit below, and turns it was done for Android
and reported by John :) And the patch author was a certain guy named
Peter :)

commit 3942a9bd7b5842a924e99ee6ec1350b8006c94ec
Author: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Date:   Thu Aug 11 18:54:13 2016 +0200

    locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write()
-----------

Basically, this commit makes the read-side cost percpu_rwsem slightly
more expensive (one smp_load_acquire of readers_block, at the cost of
making write-side a bit more expensive...)

So turns out it is weird, but it is certainly not a bug.

Learned something new but wasted my time a bit :)

Cheers, and see you later,
- Joel



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux