From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756894AbbCFUjc (ORCPT ); Fri, 6 Mar 2015 15:39:32 -0500 Received: from smtprelay0156.hostedemail.com ([216.40.44.156]:47862 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755862AbbCFUja (ORCPT ); Fri, 6 Mar 2015 15:39:30 -0500 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:5007:6261:7875:7903:8660:9012:10004:10400:10450:10455:10848:10967:11026:11232:11658:11914:12043:12296:12517:12519:12663:12740:13069:13148:13230:13311:13357:14096:14097:19904:19999:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: guide66_3556efd58e31e X-Filterd-Recvd-Size: 2419 Date: Fri, 6 Mar 2015 15:39:25 -0500 From: Steven Rostedt To: Mathieu Desnoyers Cc: Linus Torvalds , "Paul E. McKenney" , Huang Ying , Lai Jiangshan , Lai Jiangshan , Peter Zijlstra , LKML , Ingo Molnar Subject: Re: Possible lock-less list race in scheduler_ipi() Message-ID: <20150306153925.224d4383@gandalf.local.home> In-Reply-To: <20150306153821.0ece2e37@gandalf.local.home> References: <995381344.227770.1425597484864.JavaMail.zimbra@efficios.com> <950470583.228004.1425599331454.JavaMail.zimbra@efficios.com> <402283060.238174.1425652523685.JavaMail.zimbra@efficios.com> <20150306140347.64cfcad1@gandalf.local.home> <148790040.241085.1425670784201.JavaMail.zimbra@efficios.com> <20150306153821.0ece2e37@gandalf.local.home> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Mar 2015 15:38:21 -0500 Steven Rostedt wrote: > On Fri, 6 Mar 2015 19:39:44 +0000 (UTC) > Mathieu Desnoyers wrote: > > ask concurrently with the llist iteration within sched_ttwu_pending(). > > > > AFAIU, ttwu_queue_remote() is called from ttwu_queue() without holding > > the rq lock. So I'm wondering what prevents corruption of the wake_list > > in this situation. > > I guess if it is on the wake_list, then the task's state is already > RUNNING. Any other task can switch a task's state to RUNNING but only > the task itself can switch it back to something else. If the task is on > the wake_list, it's state is already RUNNING, but it has not run yet. > That means any other wakeup will jump to the "goto out" and skip over > the ttwu_queue() call. If my assumption is indeed the case, then these types of subtleties really need comments in the code. -- Steve