[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180518114054.GJ12217@hirez.programming.kicks-ass.net>
Date: Fri, 18 May 2018 13:40:54 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Kent Overstreet <kent.overstreet@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Chinner <dchinner@...hat.com>, darrick.wong@...cle.com,
tytso@....edu, linux-btrfs@...r.kernel.org, clm@...com,
jbacik@...com, viro@...iv.linux.org.uk, willy@...radead.org
Subject: Re: [PATCH 04/10] locking: export osq_lock()/osq_unlock()
On Fri, May 18, 2018 at 07:32:05AM -0400, Kent Overstreet wrote:
> It does strike me that the whole optimistic spin algorithm
> (mutex_optimistic_spin() and rwsem_optimistic_spin()) are ripe for factoring
> out. They've been growing more optimizations I see, and the optimizations mostly
> aren't specific to either locks.
There's a few unfortunate differences between the two; but yes it would
be good if we could reduce some of the duplication found there.
One of the distinct differences is that mutex (now) has the lock state
and owner in a single atomic word, while rwsem still tracks the owner in
a separate word and thus needs to account for 'inconsistent' owner
state.
And then there's warts such as ww_mutex and rwsem_owner_is_reader and
similar.
Powered by blists - more mailing lists