Messages in this thread | | | Date | Wed, 13 Apr 2022 18:00:47 +0200 | From | David Sterba <> | Subject | Re: [PATCH v2] btrfs: zstd: use spin_lock in timer callback |
| |
On Wed, Apr 13, 2022 at 05:58:41PM +0300, Nikolay Borisov wrote: > > > On 11.04.22 г. 18:55 ч., Schspa Shi wrote: > > This is an optimization for fix fee13fe96529 ("btrfs: > > correct zstd workspace manager lock to use spin_lock_bh()") > > > > The critical region for wsm.lock is only accessed by the process context and > > the softirq context. > > > > Because in the soft interrupt, the critical section will not be preempted by the > > soft interrupt again, there is no need to call spin_lock_bh(&wsm.lock) to turn > > off the soft interrupt, spin_lock(&wsm.lock) is enough for this situation. > > > > Changelog: > > v1 -> v2: > > - Change the commit message to make it more readable. > > > > [1] https://lore.kernel.org/all/20220408181523.92322-1-schspa@gmail.com/ > > > > Signed-off-by: Schspa Shi <schspa@gmail.com> > > Has there been any measurable impact by this change? While it's correct it does mean that > someone looking at the code would see that in one call site we use plain spinlock and in > another a _bh version and this is somewhat inconsistent.
I think it would be hard to measure the impact, maybe in some kind of load the _bh version would be unnecessarily blocking some other threads.
Regarding the used locking primitives, I'll add a comment about that to the function, it is indeed inconsistent and not obvious from the context.
| |