Re: [PATCH v5 4/9] percpu-refcount: Introduce percpu_ref_is_in_use()

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

 



On Wed, 2018-08-08 at 08:23 -0700, Tejun Heo wrote:
+AD4- On Tue, Aug 07, 2018 at 03:51:28PM -0700, Bart Van Assche wrote:
+AD4- +AD4- Introduce a function that allows to determine whether a per-cpu refcount
+AD4- +AD4- is in use. This function will be used in a later patch to determine
+AD4- +AD4- whether or not any block layer requests are being executed.
+AD4- 
+AD4- I thought about it a bit and am having a bit of difficulty convincing
+AD4- myself this is necessary.  Switching a percpu+AF8-ref to atomic mode isn't
+AD4- expensive - it's one spinlock cycle, a rcu wait and one sweep of the
+AD4- percpu counters.  The most expensive part - the percpu sweep - needs
+AD4- to be there even with optimization, the wait doesn't really matter as
+AD4- all it'll do is slightly delaying timer based PM operation and can be
+AD4- overlayed with the propagation of set+AF8-pm+AF8-only() anyway.
+AD4- 
+AD4- So, how about just doing the simple thing?  Switch it to atomic mode
+AD4- and check the counter and switch back to percpu mode afterwards.  If
+AD4- we see any issues with that, we can try to optimize it later but that
+AD4- seems unlikely to me.

Hello Tejun,

Switching to atomic mode would require me to add a serialization mechanism
against blk+AF8-freeze+AF8-queue+AF8-start() and blk+AF8-mq+AF8-unfreeze+AF8-queue() since these
functions call percpu+AF8-ref+AF8-kill() and percpu+AF8-ref+AF8-reinit(). That is easy but
requires additional code. I will see whether I can implement an alternative
approach using blk+AF8-mq+AF8-queue+AF8-tag+AF8-busy+AF8-iter().

Thanks,

Bart.





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux