Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755415AbbDTOmx (ORCPT ); Mon, 20 Apr 2015 10:42:53 -0400 Received: from casper.infradead.org ([85.118.1.10]:37877 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755075AbbDTOmv (ORCPT ); Mon, 20 Apr 2015 10:42:51 -0400 Date: Mon, 20 Apr 2015 16:42:35 +0200 From: Peter Zijlstra To: Davidlohr Bueso Cc: Thomas Gleixner , Ingo Molnar , Sebastian Andrzej Siewior , Linus Torvalds , Chris Mason , Steven Rostedt , fredrik.markstrom@windriver.com, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 1/2] sched: lockless wake-queues Message-ID: <20150420144235.GX27490@worktop.programming.kicks-ass.net> References: <1429471060-21271-1-git-send-email-dave@stgolabs.net> <1429471060-21271-2-git-send-email-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429471060-21271-2-git-send-email-dave@stgolabs.net> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1224 Lines: 37 On Sun, Apr 19, 2015 at 12:17:39PM -0700, Davidlohr Bueso wrote: > +void wake_q_add(struct wake_q_head *head, struct task_struct *task) > +{ > + struct wake_q_node *node = &task->wake_q; > + > + /* > + * Atomically grab the task, if ->wake_q is !nil already it means > + * its already queued (either by us or someone else) and will get the > + * wakeup due to that. > + * > + * This cmpxchg() implies a full barrier, which pairs with the write > + * barrier implied by the wakeup in wake_up_list(). > + */ > + if (cmpxchg(&node->next, NULL, WAKE_Q_TAIL)) > + return; > + > + get_task_struct(task); > + > + /* > + * The head is context local, there can be no concurrency. > + */ > + if (head->first == WAKE_Q_TAIL) > + head->first = node; > + else > + head->last->next = node; > + > + head->last = node; > +} Do we want a sched_feat() that makes the above to an immediate wake-up instead of the fancy thing? -- just for debuging/performance measurements like things? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/