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


Groups > linux.kernel > #1457941 > unrolled thread

Re: [PATCH v4 2/3] locking/mutex: Enable optimistic spinning of woken task in wait queue

Started byPeter Zijlstra <peterz@infradead.org>
First post2016-08-08 19:30 +0200
Last post2016-08-08 19:30 +0200
Articles 1 — 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 2/3] locking/mutex: Enable optimistic spinning of  woken task in wait queue Peter Zijlstra <peterz@infradead.org> - 2016-08-08 19:30 +0200

#1457941 — Re: [PATCH v4 2/3] locking/mutex: Enable optimistic spinning of woken task in wait queue

FromPeter Zijlstra <peterz@infradead.org>
Date2016-08-08 19:30 +0200
SubjectRe: [PATCH v4 2/3] locking/mutex: Enable optimistic spinning of woken task in wait queue
Message-ID<s3Wxc-4gT-39@gated-at.bofh.it>
On Mon, Jul 18, 2016 at 04:39:25PM -0400, Waiman Long wrote:
> Ding Tianhong reported a live-lock situation where a constant stream
> of incoming optimistic spinners blocked a task in the wait list from
> getting the mutex.
> 
> This patch attempts to fix this live-lock condition by enabling the
> woken task in the wait queue to enter into an optimistic spinning
> loop itself in parallel with the regular spinners in the OSQ. This
> should prevent the live-lock condition from happening.

No, two spinners are not in fact starvation proof. It makes the reported
life-lock scenario much less likely, but it does not guarantee anything.

> +		/*
> +		 * Optimistically spinning on the mutex without the wait lock

There should either be a '.' at the end of that line, or the next line
should not start with a capital.

Also, I don't see how the two sentences are related, should they be in
the same paragraph?

> +		 * The state has to be set to running to avoid another waker
> +		 * spinning on the on_cpu flag while the woken waiter is
> +		 * spinning on the mutex.
> +		 */
> +		acquired = mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx,
> +						 true);
>  		spin_lock_mutex(&lock->wait_lock, flags);
>  	}
>  	__set_task_state(task, TASK_RUNNING);

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web