Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457949 > unrolled thread

Re: [PATCH v4 3/3] locking/mutex: Ensure forward progress of waiter-spinner

Started byPeter Zijlstra <peterz@infradead.org>
First post2016-08-08 19:40 +0200
Last post2016-08-10 21:20 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v4 3/3] locking/mutex: Ensure forward progress of  waiter-spinner Peter Zijlstra <peterz@infradead.org> - 2016-08-08 19:40 +0200
    Re: [PATCH v4 3/3] locking/mutex: Ensure forward progress of  waiter-spinner Peter Zijlstra <peterz@infradead.org> - 2016-08-10 21:20 +0200

#1457949 — Re: [PATCH v4 3/3] locking/mutex: Ensure forward progress of waiter-spinner

FromPeter Zijlstra <peterz@infradead.org>
Date2016-08-08 19:40 +0200
SubjectRe: [PATCH v4 3/3] locking/mutex: Ensure forward progress of waiter-spinner
Message-ID<s3WGR-4qo-29@gated-at.bofh.it>
On Mon, Jul 18, 2016 at 04:39:26PM -0400, Waiman Long wrote:
> As both an optimistic spinner and a waiter-spinner (a woken task from
> the wait queue spinning) can be spinning on the lock at the same time,
> we cannot ensure forward progress for the waiter-spinner. Therefore,
> it is possible for the waiter-spinner to be starved of getting the
> lock, though not likely.

Right; yet your previous two changelogs/comments implied otherwise.

> This patch adds a flag to indicate that a waiter-spinner is
> spinning and hence has priority over the acquisition of the lock. A
> waiter-spinner sets this flag while spinning. An optimistic spinner
> will check this flag and yield if set. This essentially makes the
> waiter-spinner jump to the head of the optimistic spinning queue to
> acquire the lock.
> 
> There will be no increase in size for the mutex structure for 64-bit
> architectures. For 32-bit architectures, there will be a size increase
> of 4 bytes.

Alternative might be to use the LSB of mutex::owner, but that's going to
be somewhat icky too.

I'm not sure the 32bit platforms are going to be excited about growing
struct mutex...

[toc] | [next] | [standalone]


#1459617

FromPeter Zijlstra <peterz@infradead.org>
Date2016-08-10 21:20 +0200
Message-ID<s4HcJ-NR-1@gated-at.bofh.it>
In reply to#1457949
On Tue, Aug 09, 2016 at 02:00:00PM -0400, Waiman Long wrote:
> >Alternative might be to use the LSB of mutex::owner, but that's going to
> >be somewhat icky too.
> 
> I was thinking about doing that. However, the owner field is used in quite a
> number of places. It may be a bit risky to change all of them.

Agreed.

> >I'm not sure the 32bit platforms are going to be excited about growing
> >struct mutex...
> 
> Or we can make this a 64-bit architecture specific change if the increase in
> mutex size is a real concern. Actually, we don't need to use a list_head
> structure for wait_list. It can be just a pointer to mutex_waiter that has
> the list_head structure. This can save a pointer from the structure.

Just grow the thing, we can poke at it later if we get complaints.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web