lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 16 Apr 2019 17:07:26 -0400
From:   Waiman Long <longman@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Will Deacon <will.deacon@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org, x86@...nel.org,
        Davidlohr Bueso <dave@...olabs.net>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        huang ying <huang.ying.caritas@...il.com>
Subject: Re: [PATCH v4 07/16] locking/rwsem: Implement lock handoff to prevent
 lock starvation

On 04/16/2019 04:26 PM, Waiman Long wrote:
> On 04/16/2019 10:12 AM, Peter Zijlstra wrote:
>> On Sat, Apr 13, 2019 at 01:22:50PM -0400, Waiman Long wrote:
>>> +/*
>>> + * The typical HZ value is either 250 or 1000. So set the minimum waiting
>>> + * time to 4ms in the wait queue before initiating the handoff protocol.
>>> + */
>>> +#define RWSEM_WAIT_TIMEOUT	(HZ/250)
>> That seems equally unfortunate. For HZ=100 that results in 0ms, and for
>> HZ=300 that results in 3 1/3-rd ms.
>>
>> (and this is not considering Alpha,ARM and MIPS, who all have various
>> other 'creative' HZ values)
>>
>> In general aiming for sub 10ms timing using jiffies seems 'optimistic'.
> I see your point. I will change it to use sched_clock() instead.
>

Thinking about it again. I think I will just change its definition to
"((HZ + 249)/250)" for now to make sure that it is at least 1. The
handoff waiting period isn't as important in the overall scheme. Using
sched_clock() will definitely have a higher overhead than reading
jiffies. I want to minimize delay before the waiter can attempt to steal
the lock in the slowpath. That is the main reason I use this simple
scheme. We can certain change it later on if we choose to, but I would
like to focus on other more important things first.

Cheers,
Longman

Powered by blists - more mailing lists