[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 08 Aug 2014 14:16:10 -0400
From: Waiman Long <waiman.long@...com>
To: Davidlohr Bueso <davidlohr@...com>
CC: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org, Jason Low <jason.low2@...com>,
Scott J Norton <scott.norton@...com>
Subject: Re: [PATCH v2 0/7] locking/rwsem: enable reader opt-spinning & writer
respin
On 08/07/2014 07:52 PM, Davidlohr Bueso wrote:
> On Thu, 2014-08-07 at 18:26 -0400, Waiman Long wrote:
>> v1->v2:
>> - Remove patch 1 which changes preempt_enable() to
>> preempt_enable_no_resched().
>> - Remove the RWSEM_READ_OWNED macro and assume readers own the lock
>> when owner is NULL.
>> - Reduce the spin threshold to 64.
> So I still don't like this, and the fact that it is used in some
> virtualization locking bits doesn't really address the concerns about
> arbitrary logic in our general locking code.
As I said in the comments, there is no easy way to figure if all the
readers are running. I set the spin count to a relatively small number
to catch those readers with a short critical sections. For those that
hold the lock for a relatively long time, the spin will end and the task
will be put to sleep. I know the solution is not elegant, but it is
simple. I thought about using more elaborate scheme, but there is no
guarantee that that it will be better than a simple spin count while
greatly complicating the code.
> Also, why did you reduce it from 100 to 64? This very much wants to be
> commented.
In the v1 patch, the 100 spin threshold was for the whole spinning
period. In the v2 patch, I reset the count when a writer is there. There
is why I reduce the spin count a bit.
-Longman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists