Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2690877ybl; Thu, 29 Aug 2019 11:31:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgfcQARnv+sbMAqVzYZRaJkLHELGrZ7kyPEv49DgcyD5i1FrxN82Ky5DAL0aQKDUGt11qZ X-Received: by 2002:a17:90a:2e86:: with SMTP id r6mr11267181pjd.67.1567103510748; Thu, 29 Aug 2019 11:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567103510; cv=none; d=google.com; s=arc-20160816; b=eG9cdtmUC7Y2jtLDCM61OI/mG4XBJwYcJHIDF9oFFa2XX05Y7z0DH6W6fsdEZx3qCe 6pp7Bciwdw+4T/N2g4UZbVCYhtN7CjiPJIzXsNQ8gQXGtlewod2Bhla5NMLzw+oOezU7 VgHPsD2T7a4CGZPhidIT8DR4HMb7V4saSXAxXCqifBPjKMI2cbHRGmXv+1b1Camv64fc R///WFuFfZJnvglIYuYBHdzCWF5lWjWTQHWBJ94+asqyX+sJN5mLpBf01uL0us570w4Z T6YDhKoh4qlRreTVr9kEZ4xDq/GYvml693TwKK6LsgldruSBEieevE2flXHKl15ASTgO tOHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=46l5Y5Ra4OggjBe1OBKOiHRFakwJPSVvLgrQ6yUCJfg=; b=vxrTchiEg4qPQcELvhq3XqG2MUMAqlWt9Fi+b92fbBWS7UtcXBL0k5LCIo6gScLoxJ hRlAk7CE6QSroq3dcaHV5Qz4RXvy/e5sMmOivNhf9La6Agt/0v4rs9yyBoe2QVlY+evh 9+lOSq4WHOyjqyLc9lmuoyAd+MQlnPumAWqETqluF64RvET4X/LEb3qPvftGMOQtCnyd QjnBTF5lZ6qbRdVaR+sVJ2ATnTZapy9IPVb5QqBSaB4uxSg3c/1zlou7Q8Oiisk+HZch bgLNLtT8ggkHx1JeZ1KDiseBi7tFnMen/6sDQQe2NLSha7GPjHgz2povEoz7ewDxYCqn 8qxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Nm/W27Lv"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n12si2575534pgi.550.2019.08.29.11.31.35; Thu, 29 Aug 2019 11:31:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b="Nm/W27Lv"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728188AbfH2SO5 (ORCPT + 99 others); Thu, 29 Aug 2019 14:14:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:56476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729031AbfH2SOw (ORCPT ); Thu, 29 Aug 2019 14:14:52 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A532C23404; Thu, 29 Aug 2019 18:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567102491; bh=Sjz+ob3tjn27OF37DZBGEmsnfNuVRsOjYEddGEdbDeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nm/W27LvX5q6jIutVpNBx4y9VV45hJGKvwDYLv2D9OPRfC8mUhw3H49VTEC9BbUSb V/efdCElcEh30PXIAD1svT6WraFeTy2/GLL26XHSLDzjfpPv1AYYtoVzXl6PNtWZKe WePXPeZF2R4MBdqiYgaFw1vdMg+XV343dN9stSa4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sebastian Andrzej Siewior , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH AUTOSEL 5.2 47/76] sched/core: Schedule new worker even if PI-blocked Date: Thu, 29 Aug 2019 14:12:42 -0400 Message-Id: <20190829181311.7562-47-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190829181311.7562-1-sashal@kernel.org> References: <20190829181311.7562-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Andrzej Siewior [ Upstream commit b0fdc01354f45d43f082025636ef808968a27b36 ] If a task is PI-blocked (blocking on sleeping spinlock) then we don't want to schedule a new kworker if we schedule out due to lock contention because !RT does not do that as well. A spinning spinlock disables preemption and a worker does not schedule out on lock contention (but spin). On RT the RW-semaphore implementation uses an rtmutex so tsk_is_pi_blocked() will return true if a task blocks on it. In this case we will now start a new worker which may deadlock if one worker is waiting on progress from another worker. Since a RW-semaphore starts a new worker on !RT, we should do the same on RT. XFS is able to trigger this deadlock. Allow to schedule new worker if the current worker is PI-blocked. Signed-off-by: Sebastian Andrzej Siewior Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20190816160626.12742-1-bigeasy@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/sched/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4d5962232a553..42bc2986520d7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3469,7 +3469,7 @@ void __noreturn do_task_dead(void) static inline void sched_submit_work(struct task_struct *tsk) { - if (!tsk->state || tsk_is_pi_blocked(tsk)) + if (!tsk->state) return; /* @@ -3485,6 +3485,9 @@ static inline void sched_submit_work(struct task_struct *tsk) preempt_enable_no_resched(); } + if (tsk_is_pi_blocked(tsk)) + return; + /* * If we are going to sleep and we have plugged IO queued, * make sure to submit it to avoid deadlocks. -- 2.20.1