Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp439442pxb; Thu, 26 Aug 2021 06:41:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUyol4mI4vlh85BE+apOQaXi15F+3V3QKwK8bvRpk0ql0M/j8cmh5boDzVQii2xWPband+ X-Received: by 2002:a05:6402:d7:: with SMTP id i23mr4341505edu.291.1629985281345; Thu, 26 Aug 2021 06:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629985281; cv=none; d=google.com; s=arc-20160816; b=s8NcKi6jOfgX0PP0MkgkvHhpe8YipedJtV6fC9MFaSgwy/gbz+F/+WfPyFeq952CYC KqGwjZaIB0EPWbDoB0Hihnko8w8CrGBuXxI4QYxyb6In4L8XwksaWtsTMkLvSaQOh0fj 0BWAnt8NmZY7srJhPuYmq12FqwAXfK1QKlshM49IWrakqsos8Vjzt1chkWaxYwSEM8mj xUSkMKZlYKZFZZ1YMMF0lSrCm7bvXtNnxsALAcT9tJgQXNhmRd1WoZRTnKxvC1VwJmg8 tDehKDwhTiLEg5EOpLCZ+T2OTDmSl8lVm1P/bdUCZCdRqEjZDcipm7qF3rkRCdJeX/g7 F/LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:dkim-signature:dkim-signature:date; bh=6KKIsy+VNSNCkJS29DwC5EEGaQjlJ9+X5HNh+t7xyKY=; b=sRPgSKOGEzP49jGxW7ID70RbSpbdUO7/sO9p3gLy5wKSCl6q5bWHt4unnm6lyXcvdS dURpTP4F47U4ntYSb5lkpqYDcSevCzxZ61awM5FsVPrXm0pi9E5y/sJrOezKFIYbf/tM 7BEvFbvgD09fE6b5p7wZfDSX7+3lp/IqGMRInOEtwJdeH95+EMvi93ZCYFvNyfzuYXIa PLDmHPyEUrIqmtBaFARPCu32Gj5CbufLDXTSEkVzO1aw/KTAByxN+/xh62/2XaXuo/Mj 4xZlG7vXdXH/+Sv+bBm1OCuR94COK2RNpfEAZAEz7xF9TttiL9AskIpv+HtU9FUsPR4H Tp1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yNpO8R0B; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=U1u7iwsw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si3465218ejd.203.2021.08.26.06.40.33; Thu, 26 Aug 2021 06:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yNpO8R0B; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=U1u7iwsw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242714AbhHZNi3 (ORCPT + 99 others); Thu, 26 Aug 2021 09:38:29 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:60536 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242595AbhHZNi2 (ORCPT ); Thu, 26 Aug 2021 09:38:28 -0400 Date: Thu, 26 Aug 2021 15:37:38 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1629985059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=6KKIsy+VNSNCkJS29DwC5EEGaQjlJ9+X5HNh+t7xyKY=; b=yNpO8R0BKd6T417cNFvJC2omDdFLqqgohPWtjRZTaPk/TV/em8uxQ8Ni1U82Ov1cOcHzhv YdhZqoPUqlHuTvDHasWuLuNP6WBFValNfKvNjqVe10CgomdqKrMHQ1TFFmTahkUHHACU6l 5OvoanKMAulg3JnW7I6KULqJ4DVyCOBMuKWcLNjlds7YlrW0DYrCCYwyUJmLr3QiriYonL 8CdJPrUOekSMPaCF4oRQwD/571d7zT9PJgKAvyxq3ulTQ8OiQONJhHRvJAYOlR4G49T8lx GXTZGm+DDITPYBhBMg+ZirQm+BvZidoapUMufZi9fL+QtgUEXB/PxnfegAV77g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1629985059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=6KKIsy+VNSNCkJS29DwC5EEGaQjlJ9+X5HNh+t7xyKY=; b=U1u7iwswsWiidNgdbhsGYKceZMXHMdTydtgkTKhoS0bhNdhufAmlG2toHykdAnAai5UD5p BJtDtyZK6QeKu0Bg== From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Thomas Gleixner Subject: [PATCH] sched: Fix get_push_task() vs migrate_disable() Message-ID: <20210826133738.yiotqbtdaxzjsnfj@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org push_rt_task() attempts to move the currently running task away if the next runnable task has migration disabled and therefore is pinned on the current CPU. The current task is retrieved via get_push_task() which only checks for nr_cpus_allowed == 1, but does not check whether the task has migration disabled and therefore cannot be moved either. The consequence is a pointless invocation of the migration thread which correctly observes that the task cannot be moved. Return NULL if the task has migration disabled and cannot be moved to another CPU. Fixes: a7c81556ec4d3 ("sched: Fix migrate_disable() vs rt/dl balancing") Signed-off-by: Sebastian Andrzej Siewior --- kernel/sched/sched.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index e205b63d6db07..32a4945730a9b 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2259,6 +2259,9 @@ static inline struct task_struct *get_push_task(struct rq *rq) if (p->nr_cpus_allowed == 1) return NULL; + if (p->migration_disabled) + return NULL; + rq->push_busy = true; return get_task_struct(p); } -- 2.33.0