Re: [PATCH 5/5] locking/lockdep: Call lock_release after releasing the lock

From: Ingo Molnar
Date: Tue Oct 02 2018 - 05:08:54 EST



* Waiman Long <longman@xxxxxxxxxx> wrote:

> Subject: locking/lockdep: Call lock_release after releasing the lock

s/lock_release
/lock_release()

> Currently, lock_acquire() is called before acquiring the lock and
> lock_release() is called before the releasing the lock. As a result,
> the execution time of lock_release() is added to the lock hold time
> reducing locking throughput, especially for spinlocks and rwlocks which
> tend to have a much shorter lock hold time.
>
> As lock_release() is not going to update any shared data that needs
> protection from the lock, we don't actually need to call it before
> releasing the lock. So the lock_release() calls are now postponed to
> after releasing the lock for spinlocks and rwlocks.

Nice optimization!

Thanks,

Ingo