Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4616660imm; Tue, 9 Oct 2018 02:26:17 -0700 (PDT) X-Google-Smtp-Source: ACcGV600oNHamMsDpP8LiTGlHCmnFfM1Lga2OeLFI77ry+MrVImow0Ijw2n2wahKp7VhGgSZB1yd X-Received: by 2002:a62:2845:: with SMTP id o66-v6mr29085952pfo.17.1539077177266; Tue, 09 Oct 2018 02:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539077177; cv=none; d=google.com; s=arc-20160816; b=rZFw3tX134KLRkDeqdLbqVieF5+Ix+zZfms8V9X9vwDJc5+s5ZNJB5bBAZSUDSlrvL D8cMn6D5SU9UH1prSMqm7i0K12EO5Zf18iEMeRSN0Rpt/cLsJ3pItBy8AvqoVjPydewp qszbhKd83QizK880dBdTNI/jlaNY4zoOFcnMqcpdh25iEQbpxhOmgeoWdX0i8M8DFcSF EaMeJmXJiS+HcNU4yRzTzdW89dR3YKvZnyWC60ph3cdH+Oj8kOkFw9HuuVEFLXs3COty XUu0549dZKM13Hho6LhPuqiZ7Zbj7RztLK0UOtUY1quRtg7Y2kRkUEhvugHlux4PwUuu e0sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Klvx/VAbcZUESi3F+iPNMAHbNP0czwjNcz1wQrWOTH4=; b=G3yq2vjTtfdPh6A+JDsFDgsEYvPhxWdwIenjdpZ4aKKx1ymDPXaBUFIIwWMEYxZ4H6 gdHKL8D8OlSHrwan7Cmv4olEoswjWC3LZ7wi/M9yIb92rDOXQP8iDiBiYXegq4drCDKu Mku0DvEWiLwnbJeCVipLnGeVjfvp80ze5QcXoUZYUMBZjTRgpG3LCeUotkdQopDE4TEJ +a94bQ8CEVfAEth+ekVDcGJe91jK0KJ40m7iDNT8gNgO87HfWSqI6ani4eDCwWinBOwu lNFNGn6N5lp/tx4a4MyLkFqkiFhKzFA188ORnvWpqLujh87f4NjOJNJ2M3PpogXiUyIn 3wOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t192-v6si18737202pgc.485.2018.10.09.02.26.03; Tue, 09 Oct 2018 02:26:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726969AbeJIQlU (ORCPT + 99 others); Tue, 9 Oct 2018 12:41:20 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41476 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbeJIQlU (ORCPT ); Tue, 9 Oct 2018 12:41:20 -0400 Received: by mail-wr1-f67.google.com with SMTP id x12-v6so990926wru.8 for ; Tue, 09 Oct 2018 02:25:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Klvx/VAbcZUESi3F+iPNMAHbNP0czwjNcz1wQrWOTH4=; b=cK3k+ujzYgIqDBX5baoms3TTUaBKehd3yfh3hxh9uA++zVA2vbT9jcEERDkLM4TkZx 2sKtGmw2kdMnyKwlKWsvsfqXkpjzbB8Htcz29B8lxx/EYv6i90G8CgekxBXd0JgCI+zA OVpt0SbNLWdwd/zrJ7ZZ31H7Bsl3zjm1qbrFM2B4F9FEh8rULKKLQuz2AS6Dr5gOHyT3 4X/HV896zGhxXYoHdCkL6XFdZ7+WwnbWaIxawkmz0kmUJ/1hsDs507oNJ1smM2z79oto Hbr6SVnGN5nLjhPnHC7CoPp52UXKOWuzkQNbprxP8iQB3/v7wKPzL8EG9BRceyuoKphf rA9g== X-Gm-Message-State: ABuFfog7PunoGVwKPxUJz8xCJ5IeZ1JGbnd2BBJwJi5wRfYzULQgyizW aPMoyFNkd86HqePGVHDqslp8spKSoLBKZg== X-Received: by 2002:adf:edc2:: with SMTP id v2-v6mr17963846wro.208.1539077119878; Tue, 09 Oct 2018 02:25:19 -0700 (PDT) Received: from localhost.localdomain.Speedport_W_921V_1_44_000 (p200300EF2BD31613C1F2E846AEDA540D.dip0.t-ipconnect.de. [2003:ef:2bd3:1613:c1f2:e846:aeda:540d]) by smtp.gmail.com with ESMTPSA id o201-v6sm16049413wmg.16.2018.10.09.02.25.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Oct 2018 02:25:19 -0700 (PDT) From: Juri Lelli To: peterz@infradead.org, mingo@redhat.com Cc: rostedt@goodmis.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, luca.abeni@santannapisa.it, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, alessio.balsini@gmail.com, bristot@redhat.com, will.deacon@arm.com, andrea.parri@amarulasolutions.com, dietmar.eggemann@arm.com, patrick.bellasi@arm.com, henrik@austad.us, linux-rt-users@vger.kernel.org, Juri Lelli Subject: [RFD/RFC PATCH 8/8] sched: Fixup task CPUs for potential proxies. Date: Tue, 9 Oct 2018 11:24:34 +0200 Message-Id: <20181009092434.26221-9-juri.lelli@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009092434.26221-1-juri.lelli@redhat.com> References: <20181009092434.26221-1-juri.lelli@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a mutex owner with potential proxies wakes up those proxies are activated as well, on the same CPU of the owner. They might have been sleeping on a different CPU however. Fixup potential proxies CPU at wakeup time before activating them (or they get woken up with a wrong CPU reference). Signed-off-by: Juri Lelli --- kernel/sched/core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 54003515fd29..0314afe4ba80 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1664,6 +1664,14 @@ static inline void ttwu_activate(struct rq *rq, struct task_struct *p, int en_fl blocked_entry); list_del_init(&pp->blocked_entry); + /* XXX can't call set_task_cpu() because we are not holding + * neither pp->pi_lock nor task's rq lock. This should however + * be fine as this task can't be woken up as it is blocked on + * this mutex atm. + * A problem however might be that __set_task_cpu() calls + * set_task_rq() which deals with groups and such... + */ + __set_task_cpu(pp, cpu_of(rq)); activate_task(rq, pp, en_flags); pp->on_rq = TASK_ON_RQ_QUEUED; resched_curr(rq); @@ -3847,7 +3855,8 @@ static void __sched notrace __schedule(bool preempt) * whether it wants to wake up a task to maintain * concurrency. */ - if (prev->flags & PF_WQ_WORKER) { + if ((prev->flags & PF_WQ_WORKER) && + !task_is_blocked(prev)) { struct task_struct *to_wakeup; to_wakeup = wq_worker_sleeping(prev); -- 2.17.1