Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2705896rdb; Fri, 8 Dec 2023 17:18:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHT0dQHHjQKyqvxdGKuOB5YXSwNdPe+Hun22wF+hgmW+BzG4M9XWPvmn5DkSB9AqGeJEllz X-Received: by 2002:a17:902:e849:b0:1d0:6ffd:610e with SMTP id t9-20020a170902e84900b001d06ffd610emr1350339plg.48.1702084736011; Fri, 08 Dec 2023 17:18:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702084735; cv=none; d=google.com; s=arc-20160816; b=E3EFPprF+Omxg57VDynAAOTFNWLdChWzEvrCyb+ePufZwFOjQaRSIpwTK5Jk6g0wL3 GGiZ4vUgzbyvefaPA69Hh/Y+6yawMzZX6sp2J7UKp9pjwvcKLtZrqnlRfboJbBEEoHun sjU0hr9QAvhkZPSYZN/qCw4rI3acGrwuimIfMVvj9hgToeVhjhInysKMrEOlVffvvlN6 TPnJeuhNkqTYo7hxl7nM0Vric5GcqdhjneVGifcXPBt1V0oevS/Fa9RaoktyTI0hN/Sw PqyRByhJkcJtOBL96RXPV0HBJ7slamwaHuQvJIf6rgcraSRW6W3fRdZj7NKJ/4D3s6x9 oYvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bNtn2YYHJ/gujw3iF8Q22njCO/GKk7CSLq1wmrKmLcA=; fh=ptJZNF7Uf4aZVIiFST32p0RyPPsHf6zX2errdYyP8S4=; b=masW/bf5nIcZeMAOzzuwX6sgct6I7XU9/8r3gnPlNHi14OxbLmZmzNuvHYc/WzXUyy z16ZKmP+PLJAJXNi8yIpJ4tOBzxP55gYJJyvlKDAcI/k5nGqRvrttCnpw50OS9+t8yu8 Xr+nMollBDAXWCTXS2HvY8ANHXBXJl/esh3qTKTe4aCQ5/RPrT2T6V12m4mBLe/VFVuG uWwaR3GPuu9E4K/yjmvIf9phpmMkYOvDtOoO/Hcm0S16M73m3P5pCgHl8tSgOih0oZkR mOrdNemewUcA9kksTaB2Q8FVj+ZK56YirI8vYZImPLye54JV0LNcHD4tz27bIfyTDvrm 2Epg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=jp26gNEP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id e15-20020a170902ed8f00b001cf5cb5ac88si2150456plj.486.2023.12.08.17.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 17:18:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=jp26gNEP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3673C83BBC30; Fri, 8 Dec 2023 17:18:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234161AbjLIBS0 (ORCPT + 99 others); Fri, 8 Dec 2023 20:18:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbjLIBSY (ORCPT ); Fri, 8 Dec 2023 20:18:24 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F1DDA for ; Fri, 8 Dec 2023 17:18:30 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40c3ca9472dso2235935e9.2 for ; Fri, 08 Dec 2023 17:18:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1702084709; x=1702689509; 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=bNtn2YYHJ/gujw3iF8Q22njCO/GKk7CSLq1wmrKmLcA=; b=jp26gNEPZlfjzN+Eo/Vn8RCYCpsMPrrdAhum1zimgthoYgU/uigE0aC14TDlDp8Sip NiuQ5NSGWi8YhzZ1JvZ9XiqK0/+I5CtvkkoJnE+jVypUX0g+jBnGq0aqlEqXI2W6wwCE 6m+c0huaB+DVPLz8A+89rqYMK9w/vGtnk6RVsh/16uG/YK9u/tTt/eZrt50UA9AMuZVK 7cOxpJkUxdjjIy7NGdTC6ue/KADHttKGbjROA/9moexj8eyrjOBrOoHw3IH4IfifBPWc eIpOFlc6Qmw7FAzURmENEYXV06VMH/YYKMcxs/Z3WyK84vNHoPVGCmXhdmxCwvNkUtIX 9VvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702084709; x=1702689509; 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=bNtn2YYHJ/gujw3iF8Q22njCO/GKk7CSLq1wmrKmLcA=; b=lB9okYK6Y3FdN6UUpw6QLXmZ5rtn967SXImhKVpIaKOzIxBxsVf2q0B/i6KWk3L2Ol eqb0q2+FB8OPu/A26cgu+PP2hCaMygmEDJVM+FzLYF20JXq1PGPa4hPsip6esr7SETXY jtaIWgRDiEc3lLhTeLtYItp2tbTG8TSpVvpgdMbFmJ5G2DnsMFtiTJqLt46TITmptTKv 83KjEJIA2B00Ic+fSDhQ9rn/I9txDBStinr5ZC5oqVjTKz+qX6N53Yr8jxXoQeC2P4zS yJtwSKTTuMeL+EL3dB7M8sl6HZlUFNP0hH0QV61aOPGhF3RSATI1wuVcHpoaPIxYa15o jxSA== X-Gm-Message-State: AOJu0YzGBUCcaGuXkfavAn5ebjmDT6CrxbIKGw+RuloZP7xSkZ7lOovv zh8HYPiOrxQ9S19ZK44IyYrHAQ== X-Received: by 2002:a05:600c:230e:b0:40c:2cc4:d98b with SMTP id 14-20020a05600c230e00b0040c2cc4d98bmr272574wmo.249.1702084708484; Fri, 08 Dec 2023 17:18:28 -0800 (PST) Received: from airbuntu.. (host109-153-232-45.range109-153.btcentralplus.com. [109.153.232.45]) by smtp.gmail.com with ESMTPSA id b16-20020a05600c4e1000b0040c310abc4bsm4772125wmq.43.2023.12.08.17.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 17:18:27 -0800 (PST) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Lukasz Luba , Wei Wang , Rick Yiu , Chung-Kai Mei , Qais Yousef Subject: [PATCH 0/3] sched: Generalize misfit load balance Date: Sat, 9 Dec 2023 01:17:56 +0000 Message-Id: <20231209011759.398021-1-qyousef@layalina.io> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 08 Dec 2023 17:18:48 -0800 (PST) Misfit load balance was added to help handle HMP systems where we can make a wrong decision at wake up thinking a task can run at a smaller core, but its characteristics change and requires to migrate to a bigger core to meet its performance demands. With the addition of uclamp, we can encounter more cases where such wrong placement decisions can be made and require load balancer to do a corrective action. Specifically if a big task capped by uclamp_max was placed on a big core at wake up because EAS thought it is the most energy efficient core at the time, the dynamics of the system might change where other uncapped tasks might wake up on the cluster and there could be a better new more energy efficient placement for the capped task(s). We can generalize the misfit load balance to handle different type of misfits (whatever they may be) by simply giving it a reason. The reason can decide the type of action required then. Current misfit implementation is considered MISFIT_PERF. Which means we need to move a task to a better CPU to meet its performance requirement. For UCLAMP_MAX I propose MISFIT_POWER, where we need to find a better placement to control its impact on power. Once we have an API to annotate latency sensitive tasks, it is anticipated MISFIT_LATENCY load balance will be required to help handle oversubscribe situations to help better distribute the latency sensitive tasks to help reduce their wake up latency. Patch 1 splits misfit status update from misfit detection by adding a new function is_misfit_task(). Patch 2 implements the generalization logic by adding a misfit reason and propagating that correctly and guarding the current misfit code with MISFIT_PERF reason. Patch 3 is an RFC on a potential implementation for MISFIT_POWER. Patch 1 and 2 were tested stand alone and had no regression observed and should not introduce a functional change and can be considered for merge if they make sense after addressing any review comments. Patch 3 was only tested to verify it does what I expected it to do. But no real power/perf testing was done. Mainly because I was expecting to remove uclamp max-aggregation [1] and the RFC I currently have (which I wrote many many months ago) is tied to detecting a task being uncapped by max-aggregation. I need to rethink the detection mechanism. Beside that, the logic relies on using find_energy_efficient_cpu() to find the best potential new placement for the task. To do that though, we need to force every CPU to do the MISFIT_POWER load balance as we don't know which CPU should do the pull. But there might be better thoughts on how to handle this. So feedback and thoughts would be appreciated. [1] https://lore.kernel.org/lkml/20231208015242.385103-1-qyousef@layalina.io/ Thanks! -- Qais Yousef Qais Yousef (3): sched/fair: Add is_misfit_task() function sched/fair: Generalize misfit lb by adding a misfit reason sched/fair: Implement new type of misfit MISFIT_POWER kernel/sched/fair.c | 115 +++++++++++++++++++++++++++++++++++++------ kernel/sched/sched.h | 9 ++++ 2 files changed, 110 insertions(+), 14 deletions(-) -- 2.34.1