Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp263382lqg; Fri, 1 Mar 2024 04:47:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXT5F4M6vtbA27poQB2wAqtOsFrSSKH7b6L39mCpV47dqWxG6ShRz+CD2kY37ROnU295Mct7s6vsYB8/LvYNyYaNBwQeHdtxpC3gGR51Q== X-Google-Smtp-Source: AGHT+IEyZidUAueH9N3FRSz7QQrcrKty/B3/cDoQ+MzC+1H8U/pfKGtBV22x3naKuw7A/KvSALGu X-Received: by 2002:a17:906:699:b0:a44:9686:b533 with SMTP id u25-20020a170906069900b00a449686b533mr997429ejb.6.1709297231921; Fri, 01 Mar 2024 04:47:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709297231; cv=pass; d=google.com; s=arc-20160816; b=Ot/GIwBP8A6ybofNzVvpNnXQOYlZD9Dcypw9wfnaNlgcqCsr3GOTu4CGXotjw1NHxq VPOJl3FdoxmrtG5gXGwdd+VDY6a2XubXustxbsytcZkHfevSjlTkGDGy8uhLf7N8FlE0 kYJlMi157Dn7oss7A0/7DZrdFNDysRbt3jC4MUaWW+dSyYs2/UakgtQEVP9RgwNnjqLP BLClarf3kzGjd65jZae82Ur6rqcqoC2CJrIofPz01svbvlg62FJ66Ix0s93TyMqtCIn5 uEZnQ/f+DzJ3CtZC0idjmYQSswOW+4Df7cv2QSbKNMhfuwy8NQ4B7JcecQFHdvSC6Jjj yjAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=M2eeFzJsafgYjz1aTeqb4t74nvXWY+dyBVmhOrpXIj0=; fh=rA3WdiBfQt4WWlKYhCSLORohIPlLtMRi5yP50jon6Ik=; b=JBC5vhmqF6AXLkkzEFONQ9+XOb5/A3ex32SiNnu38DrxoFptahp8QM6N9JYdKS9qOQ XYA3zPb27Rp1K7Gh2ZAN23mZqLDBi2Sc87vosUeN6ppWeKmY4+dBu96D6xRXheW75vEd SKVeOzR+gAYRZAqKfazE3+ueYwdWZTHVknYmovBgsnNN74ykw6Halo5yrpU0PJ+B+7Kl SUT3HefiNWd/XcQKF9yhR1ZeHaNXz48C0WnUI41xJLlz7MJ76OhI1EYLoSp7jkhZQlTP Ve5xHBJQ0lgvZzyMZBf72OIqI9JQ95ImaYPeNyrYcYKozIksEqcuR1Cw5m2zWAOiUt0P +snw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kE8kJxhE; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-88414-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hq22-20020a1709073f1600b00a3e3a3786dfsi1477428ejc.925.2024.03.01.04.47.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 04:47:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88414-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kE8kJxhE; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-88414-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 17EF31F22938 for ; Fri, 1 Mar 2024 12:46:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 931D56BB4B; Fri, 1 Mar 2024 12:46:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kE8kJxhE" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79DF77E1 for ; Fri, 1 Mar 2024 12:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709297176; cv=none; b=PMwTDpBIlgAkVxXsZHnkJjlEaybATLzDDtLdW/wUspTIC8xTassg3uKzab6JHAqKkjXOhWNHYTJIBjWAek0a+oGR0MS/ccxIzc7Zb6Ew/nqZNqpoAiwAWonQJ30njxtYRgA5OmIfgIAkJGW2/iUxzmCNtTvLo4P83cPaRRVP8sw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709297176; c=relaxed/simple; bh=AZR+noD3l0LO4X6LkzgkiZes2MssLiK0uXwj8oDVL8I=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=AnNr0CyYEqB2pCCIu4W0XqBx8SaFh6gOgFj0bl2QNCrmMeKGMhX+knmqnHs8SpHUK0Hf10cKQd3k3QMg8BVrrJJFVkiL+N+AJQ2gjlSR/Sc19Jp9O+JyHjZv2rabKVrFskR8vqDsJqRIZNVAZkneT7URWd0oAxBFJQtt5GeDIkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kE8kJxhE; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6e5d7f1f15bso28158b3a.2 for ; Fri, 01 Mar 2024 04:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709297174; x=1709901974; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=M2eeFzJsafgYjz1aTeqb4t74nvXWY+dyBVmhOrpXIj0=; b=kE8kJxhE+ghRjEca9RTo6vSMAPqY/+yRygLi7vkCFyhIAD1u5G3Pi1RCpXEbAniXjt /lVnjBUiCTOH/SJwWWBQvkB9tKKk6wgo3ZbjOLQ0dSllE0Y0JgsnU63cmFHN+42bKRuW fyA63kn6bZDFb/iO9sTfr2DqRQC+JbhuYOVobEH5q61u2mmPkyAmxWC3l5A1e3ojDHsP 1+8RN+26NoOCt6EIGTF5n1TQW9kyw4uViUdRiaF/QxhlE5jP736kWTxb7YZ8ISahpTkT okwBue04+geXUwnIT/WuiXutklfzDf5Oa8rvJ1qxtmVpNxloXMOI6YKKHUvJb43Mt+Ik 3uOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709297174; x=1709901974; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M2eeFzJsafgYjz1aTeqb4t74nvXWY+dyBVmhOrpXIj0=; b=b4QR8kZdHaATtihtOmsPZ4r8aykmxMCh5JVq5ALJlV6ANyxdpb1Yvma+L31uF3cOcY oBS3swyGUpaTrSM8hGzWLv2Py4Qt8lw/1j8Z7GVRqMZd5ieZFZmlqQ/0glIZO9XDd8nF enSDujrc7avtckXsOw5UoMv0JKduNjzUwvFI4yfp1USEaRC5qwO6Vy0FevMtwz0+nuLN U7orXh8Hjn5/CFsTg0Yo/9l06K27tpEuG3QoIBkLLNLxQtZ/Ne49tEykpCeGvpdsKZ5d PSeLCdOJ+YzuHLfoCrUZf8hGbr5eA0siPftnu0ZJqE22hnM1m4zrBCRjJ10l+9I3wEIi u98Q== X-Gm-Message-State: AOJu0Yz4jnn3TSxrcwnv4KHESvy4DelY7AsGXhx1I1g2zjtStJ9mBdNz 0A+H3OgiCZmEZTxStpUROBHS5DMVfn11FL2WU5dpoqTCq2UV658omsW3xuVme9Q= X-Received: by 2002:a05:6a00:b48:b0:6e5:af58:20ac with SMTP id p8-20020a056a000b4800b006e5af5820acmr1656806pfo.13.1709297174476; Fri, 01 Mar 2024 04:46:14 -0800 (PST) Received: from bala-mariner.. ([167.220.238.143]) by smtp.gmail.com with ESMTPSA id w7-20020aa79a07000000b006e5ac1b3c13sm1703751pfj.138.2024.03.01.04.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 04:46:14 -0800 (PST) From: bala To: linux-kernel@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org, Bala Subject: [PATCH] Check whether the wakeup task is eligible first Date: Fri, 1 Mar 2024 12:45:56 +0000 Message-Id: <20240301124556.248820-1-kumaran.4353@gmail.com> X-Mailer: git-send-email 2.33.8 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Bala check_prempt_wakeup_fair is checking whether the current task has to be preempted by the newly wake-up task. To avoid multiple swaps the logic is decided as if the wake-up task is the best task then only preempt the current task. In CFS time, getting the best task was as simple as piking the left-most node. But in EEVDF non-fast path, the entire tree has to be traversed in a worst case scenario. So, IMHO let's first check the newly wake-up task is eligible before searching for the best task. At least until the comment becomes effective to preempt the curr irrespective of the waking task. --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 533547e3c90a..8d810d6a2cb7 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8334,7 +8334,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int /* * XXX pick_eevdf(cfs_rq) != se ? */ - if (pick_eevdf(cfs_rq) == pse) + if (entity_eligible(cfs_rq, pse) && (pick_eevdf(cfs_rq) == pse)) goto preempt; return; -- 2.33.8