Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp576123pxb; Thu, 26 Aug 2021 09:27:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwcqfX9QLGrO4dK72Xq3fHLL8wtCxcpAYTsiTEThz1yn+JlcVw23FTcwRVt/yN+1KLKSUv X-Received: by 2002:a17:906:b18c:: with SMTP id w12mr5183193ejy.534.1629995237764; Thu, 26 Aug 2021 09:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629995237; cv=none; d=google.com; s=arc-20160816; b=ouGIEFaTOqYBZAUKRzSR26TJtBhTE/pIeQqOXY/I/0ZwyW70qFF/sekh8uX9bFyl6H Q5yWCcr/NHRb7IiFG27RfJZSvyThJzFJcFTYvViilIeKBbVHcUMLPV96+mL+5sQq0i2k kwwA9DdSOl84uEshezosmQY8UYBeTIXS7Yq5jLzvUd2M4df6TQwVd49aABMyFI1wMN8i cFBJ3BAYrBXSnZ9sW2LZe4MogNptQw5l71LA9Y31yAbP8mS5IlS10PjMwVXWY3IqvAbO iGM9tO0/pH/YN32OICt3kBfZRQa3KC5WmStOjJAQDp6eT+4wR0T9UdtO9H0+WdHDI02h URjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=eeA/EblnvWIy9V7dZ552OXTY1UGszfZzpi/NUgGy4SU=; b=EolIBa6Kskb+3rSmlDF5hmSWeaA2Imqx0KuWpACrcmSeWjtQrcjSE1aFrWFqefW40w yjK7SxLceXO/jiZGkXDniLT4/WyOmCKq9Pix3gSf+/sGVTCJTVltEtvOah3x3N7HUft+ EF/tgna02hiOfL7yDpoTyH2bkFMdbtJudSp/3i9rn+W1qNaMXkOi666RXmtIyvw+vNDC dsXkzvjWdbyN7ha3TCwOU2jB5LAXDa1b1cRAPuzrGKWr7EkNAzLl2dWNG3ryLnzmxOUV FWeU4Zbvh1QgwRnBG5LgbIQ+CsSsDMAwGgQvQySRLLPaZjz9xrSMThr32RJR/APdWb3m Drwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mjWiEZgV; 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=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si3368419edw.388.2021.08.26.09.26.42; Thu, 26 Aug 2021 09:27:17 -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=@linux.dev header.s=key1 header.b=mjWiEZgV; 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=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243050AbhHZQZZ (ORCPT + 99 others); Thu, 26 Aug 2021 12:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243044AbhHZQZE (ORCPT ); Thu, 26 Aug 2021 12:25:04 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82DE4C061757 for ; Thu, 26 Aug 2021 09:24:16 -0700 (PDT) Date: Fri, 27 Aug 2021 00:24:58 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1629995053; 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: in-reply-to:in-reply-to:references:references; bh=eeA/EblnvWIy9V7dZ552OXTY1UGszfZzpi/NUgGy4SU=; b=mjWiEZgVq4SEQTk+Zop2fdzgYirnncPUw/G7ra2npWRudz5plazHu9a7zPziB4Jqoh+XOe MWFvwDJrn5wFWG94sKLJqLBU1LmIIv9AOYdntDz3Wkk3cjSFep7InIh6h7Z0g1PZbv40Ww QMOu9pgBJM4NQ0RLXEbon/+VMea7/8k= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Tao Zhou To: Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, tao.zhou@linux.dev Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Thomas Gleixner Subject: Re: [PATCH] sched: Fix get_push_task() vs migrate_disable() Message-ID: References: <20210826133738.yiotqbtdaxzjsnfj@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210826133738.yiotqbtdaxzjsnfj@linutronix.de> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: tao.zhou@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sebastian, On Thu, Aug 26, 2021 at 03:37:38PM +0200, Sebastian Andrzej Siewior wrote: > 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; Not much I can restore here.. Is is_migration_disabled(p) be more correct to check migration disable. And get_push_task() being called in pull_rt_task() has checked migration disable first and then call get_push_task(). That means this check in get_push_task() in patch is a second repeatly check. > rq->push_busy = true; > return get_task_struct(p); > } > -- > 2.33.0 > Thanks, Tao