Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp589649ybh; Wed, 11 Mar 2020 07:02:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vudtc2dVNl25OkIVW4xtfCevpjZVWs2tR2Oevqm5e07RgzcoTDHh9TcSrtmxifeF6qhhEQ/ X-Received: by 2002:aca:4e08:: with SMTP id c8mr2053945oib.143.1583935355189; Wed, 11 Mar 2020 07:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583935355; cv=none; d=google.com; s=arc-20160816; b=O6TGFRvnHTNOWnI7v2vvlgut3Wu3mAbi/IA+4Jvg32IizPglxTHOJTqn8VIBPpXdn4 P9Nz5xzrwIyRhZie2LEN3OPzvNd3uDq5ba5EO743k52NKG4EKwkBUzOhuli3l6v7Ap1P o+GAYww9vky+Je7hTv6JSdfynUQw3mOTtiyS4NakRh/6tiXwUDDtYBzaAUgotpjYDMdd YMNUudAF1wvQoaW5SQ3kqEVMC79HSdZ09oCcjGkjQ4ySjFhoWopzAbcar5xsoBukrTsy iTjC8jNzLXFlfZM9kemK7vDfc0gbn4E1TuJZ9o5gNpZbIU2u9T2fJLimSP2b/aP39yJc s27g== 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:subject:cc:to:from:date; bh=mCme1oljB2lChbLZX2GBJ5eKFM560E0ImZSCTwuTrRY=; b=rchch3OL3AH5nFvJcCKtgl6EB9zqXpFSCXmYjzEPtuiNxA92p7a/8xdpvL6D91hYtw j9cctah2ENY0E76ieaYakBKp8tkjv3G8IhHdMi2MQwfuzhClJK0sqJyA6NGCJQCOySVb xBTS/r/GarBH6WANdgwNv6QfcM4vhVE7tgnnqA/E2u0TmpYGhgWRY9AR30FKNLY4fHGN TuoRF/dCjpoRU6VbfGyQYBGzgX4AvTX8fiL0tlGRdAezLVx0hoxcGts8pZ7/8/EokkdF loX/zrgu9P6CVz9HidsY3FVDqVPXdI+fcG1x/2VO8jwnTae5UWi9o9R7pxDaqKxXSb4P Ss5A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si1073359oix.12.2020.03.11.07.02.18; Wed, 11 Mar 2020 07:02:35 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729725AbgCKOAY (ORCPT + 99 others); Wed, 11 Mar 2020 10:00:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:48068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729479AbgCKOAX (ORCPT ); Wed, 11 Mar 2020 10:00:23 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2385C21D7E; Wed, 11 Mar 2020 14:00:22 +0000 (UTC) Date: Wed, 11 Mar 2020 10:00:20 -0400 From: Steven Rostedt To: Qais Yousef Cc: Ingo Molnar , Peter Zijlstra , Dietmar Eggemann , Pavan Kondeti , Juri Lelli , Vincent Guittot , Ben Segall , Mel Gorman , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 6/6] sched/rt: Fix pushing unfit tasks to a better CPU Message-ID: <20200311100020.63bb81e5@gandalf.local.home> In-Reply-To: <20200302132721.8353-7-qais.yousef@arm.com> References: <20200302132721.8353-1-qais.yousef@arm.com> <20200302132721.8353-7-qais.yousef@arm.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2 Mar 2020 13:27:21 +0000 Qais Yousef wrote: > + * Don't bother moving it if the destination CPU is > + * not running a lower priority task. > + */ > + if (p->prio < cpu_rq(target)->rt.highest_prio.curr) { > + > + cpu = target; > + > + } else if (p->prio == cpu_rq(target)->rt.highest_prio.curr) { > + > + /* > + * If the priority is the same and the new CPU > + * is a better fit, then move, otherwise don't > + * bother here either. > + */ > + if (fit_target) > + cpu = target; > + } BTW, A little better algorithm would be to test fit_target first: target_prio = cpu_rq(target)->rt.hightest_prio.curr; if (p->prio < target_prio) { cpu = target; } else if (fit_target && p->prio == target_prio) { cpu = target; } Which can also just be a single if statement: if (p->prio < target_prio || (fit_target && p->prio == target_prio) cpu = target; -- Steve