From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751867AbdBMKFO (ORCPT ); Mon, 13 Feb 2017 05:05:14 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:36338 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751764AbdBMKFM (ORCPT ); Mon, 13 Feb 2017 05:05:12 -0500 Date: Mon, 13 Feb 2017 11:04:57 +0100 From: Peter Zijlstra To: Byungchul Park Cc: mingo@kernel.org, neilb@suse.de, nab@linux-iscsi.org, viro@zeniv.linux.org.uk, ying.huang@intel.com, oleg@redhat.com, shli@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 8/9] sched: Don't reinvent the wheel but use existing llist API Message-ID: <20170213100457.GL6515@twins.programming.kicks-ass.net> References: <1486970469-30917-1-git-send-email-byungchul.park@lge.com> <1486970469-30917-9-git-send-email-byungchul.park@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1486970469-30917-9-git-send-email-byungchul.park@lge.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 13, 2017 at 04:21:08PM +0900, Byungchul Park wrote: > Although llist provides proper APIs, they are not used. Make them used. > > Signed-off-by: Byungchul Park > --- > kernel/sched/core.c | 13 ++----------- > 1 file changed, 2 insertions(+), 11 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index d01f9d0..417060b 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -1783,17 +1783,8 @@ void sched_ttwu_pending(void) > raw_spin_lock_irqsave(&rq->lock, flags); > rq_pin_lock(rq, &rf); > > - while (llist) { > - int wake_flags = 0; > - > - p = llist_entry(llist, struct task_struct, wake_entry); > - llist = llist_next(llist); > - > - if (p->sched_remote_wakeup) > - wake_flags = WF_MIGRATED; > - > - ttwu_do_activate(rq, p, wake_flags, &rf); > - } > + llist_for_each_entry(p, llist, wake_entry) > + ttwu_do_activate(rq, p, p->sched_remote_wakeup ? WF_MIGRATED : 0, &rf); I think this suffers the exact same problem the others did. After ttwu_do_activate() the llist entry can be reused, so doing list_next() after it is flaky.