Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2026235rdb; Tue, 20 Feb 2024 14:56:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUPviaixWNPR4h22S8jEKCZLx+YGpcrk5H8u+XR6G1figZ/uVVAhqMzgRjri71L53ljA/XUjqbbIUEIej+j2xKhtLHa3MBnNk1Xk4thFQ== X-Google-Smtp-Source: AGHT+IHTF0OqT1JkX50tvONM/INGvQGOfVvj8PFU1rDOcLftlf9jJwVNneXRLZAA4vEW8nePKlMO X-Received: by 2002:a05:6870:80d3:b0:21e:8938:9091 with SMTP id r19-20020a05687080d300b0021e89389091mr12196976oab.27.1708469809260; Tue, 20 Feb 2024 14:56:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708469809; cv=pass; d=google.com; s=arc-20160816; b=Hsrr/UlkzLaP8p5nz9cj/QBvnc50HCzPVn7kSvoSF1H0jEmJvKUuFJ6HEW9xuG8N3U Q/oXHQZHr7YSL91rXEgzoaqLs5Uy+/26zhd1NUoLTGiDRGvB/T1rfM1B+thCCnqCk4TD 0KfQ/Oq5++6qyn/y2gT67mfXYDi7NIiprqirk+oTwpgjE6FJjRWRPeLoZ+unNyXEp7ZD klCsRqrjXPLH73FdgRUQjD6+sYe3SG88Vb0auv2VPDlfcIu3ydzT2AVZBquFs1/K0gzj smi7Wy/lOh+PXihEr8lll/I9Tlpm7mFGNritfWALaLA+z9AR7oMXI7TmHhPfVx0i02dG OaSw== 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=iHb+hTJmKe22yutOBTSZnGZN2hn9i5iDOLgqAiudVmM=; fh=LFahd4jziOLZv88JjnLsQAu+Hg6/pa5kYd3YC5wdhMk=; b=DcxnLdTbQMvAq6OMtOw9t8L1EhWCkO2e+09foAM50AjMz+qHnnronLcRgtu+Vr7nGM S0GICAGaSHL4BR6dZVXSDMHuHHaA+5YhaPw2CZDdDhYaoomQuyS1536xrYCvyMZ4YpS1 RiSTlbP8zQpq3rwp/7CtDgryEx5s1r93QGN+V5I0jeKEW/XPB719DKkpTLtxnrviL3xJ 78G9bTJNs0a/65ZFH92ev6HImCaD2zF1CZgx8RP9VoBdM3WfeFQAlYd+4uFlm8d2D81W BVwuU89MLxKhGltU2DD2ariJgfN/kzD/0WMOkM70Zd9d7VUulo4z9YTCzBoUpRdQ1czf TQdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=mJyJbkXJ; arc=pass (i=1 spf=pass spfdomain=layalina.io dkim=pass dkdomain=layalina-io.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-73784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73784-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y22-20020a637d16000000b005cf60fc5fc9si6674688pgc.274.2024.02.20.14.56.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 14:56:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=mJyJbkXJ; arc=pass (i=1 spf=pass spfdomain=layalina.io dkim=pass dkdomain=layalina-io.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-73784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73784-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C90BF284182 for ; Tue, 20 Feb 2024 22:56:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C0FC154437; Tue, 20 Feb 2024 22:56:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b="mJyJbkXJ" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 D0BEA69D10 for ; Tue, 20 Feb 2024 22:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708469799; cv=none; b=j2dFxC5/h42IEok3907QboGPAuUgZIcX/P0DvzierdppmVEakqYVO6mMOHjFMiBqDceLPs7g6mAmuRFbBTMFcHPu6LSigVQrMOMxJocTPd9Sgs3msocZ9KoqsXUl5KHa+Ay+HLYZFPodKdZM1ZHtwC10RULt3bsWd709KSjhshg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708469799; c=relaxed/simple; bh=ESIIGkAxFVmz8aZFqUtrXsIIwRpegfBax+DZH3x5Jkc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TS3wyQlQImrNHLnjc09UZdoq0QlcmiEzXuEMaOdPKIIKKK0B1KkhZUwNGGEpFTEGF2a2m+BFd/2Japlq3NO4LYUNTK2yI/2nZn+Y7cE5sMCYodKeVZxgPJ4HXjor0Ij3US8GNLBvK3wBxU+PwNTylkj5Nq0kLCakxWRKJxr1dpo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io; spf=pass smtp.mailfrom=layalina.io; dkim=pass (2048-bit key) header.d=layalina-io.20230601.gappssmtp.com header.i=@layalina-io.20230601.gappssmtp.com header.b=mJyJbkXJ; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=layalina.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=layalina.io Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a3e87b2de41so267798566b.2 for ; Tue, 20 Feb 2024 14:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1708469795; x=1709074595; 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=iHb+hTJmKe22yutOBTSZnGZN2hn9i5iDOLgqAiudVmM=; b=mJyJbkXJ/31vXTQEv0Kqzk6G9ZuGhNloS4qnKN4WtNo0MO8jiY4Awa5AQEiLnYyJxE WMfgDAKXw+YOjeag7fptpGr1T5S6hw/Lbnr6cYFAOXyQzfdvd0ocLbnmWyPaP5rI7YnI 3+enjWItzNmOsHq/3a5Vf6I1gcHWEs4HIH7rfJETNU+/HHAtdZG3bOjQuWkt8M2XH/IY 3yYwkEHAw7JapkOtlCxJgHjxvkfLH0bKC88pIVEWuC5MXLQ2tGoT30K0InJHB+T5WcRL OToHcIkKIpPHhCcZleKxIMcNVnwtcVF0RDFcY+M8bZHxt8o5dKIQPu9yBqoyI7DmENjm Uqtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708469795; x=1709074595; 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=iHb+hTJmKe22yutOBTSZnGZN2hn9i5iDOLgqAiudVmM=; b=tFF1TG7QL8BiInY3LS9AIh+pvRRuJdVJXf2Ju21p670GHDKTdDY4JHwXMIs0xhbczX St2R1AMEw329+8WznPvuaVbysR6j2Y8Id0LaNbbfDCIvhmX5vEzL54rr5YuffH+rhHTx PBFj6n/w6DbfuNK+hQgoldcx35lO5RxYHHoS7Ol/lduUo2h4aoyitsSny2ho5Tji+neM EcCCkWvHOAQYJThQI8eVKFEht8wKPUkIbog1KfO8iL+Qa+Ig/cTe8lRu3NYEw6KyWjWc M5dF6OIUrDX8U7pZI8j0e/XvEzhK9l7E0OB4UQwcs/LAvCwpIUd/xYaMIPmlgbZSj2bA K7Xw== X-Gm-Message-State: AOJu0YwHoXCc7taJARooiBwkwQMt6PFNFZ7pBHsuATCKXQUgReph4EjH DHB0lL7vgG7IV+xQ5o2NfgbioBQXO+mJyO3ODR45GfJY03U4U1YkdmbUsyhwLis= X-Received: by 2002:a17:906:f88a:b0:a3e:9ce3:1bb with SMTP id lg10-20020a170906f88a00b00a3e9ce301bbmr4528280ejb.3.1708469794954; Tue, 20 Feb 2024 14:56:34 -0800 (PST) Received: from airbuntu.. (host109-154-46-208.range109-154.btcentralplus.com. [109.154.46.208]) by smtp.gmail.com with ESMTPSA id vw13-20020a170907a70d00b00a3c5d10bcdbsm4381946ejc.114.2024.02.20.14.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 14:56:34 -0800 (PST) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, "Pierre Gondois" , Qais Yousef Subject: [PATCH v6 0/4] sched: Don't trigger misfit if affinity is restricted Date: Tue, 20 Feb 2024 22:56:18 +0000 Message-Id: <20240220225622.2626569-1-qyousef@layalina.io> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Changes since v5: * Remove redundant check to rq->rd->max_cpu_capacity * Simplify check_misfit_status() further by removing unnecessary checks. * Add new patch to remove no longer used rd->max_cpu_capacity * Add new patch to prevent misfit lb from polluting balance_interval and nr_balance_failed Changes since v4: * Store max_allowed_capacity in task_struct and populate it when affinity changes to avoid iterating through the capacities list in the fast path (Vincent) * Use rq->rd->max_cpu_capacity which is updated after hotplug operations to check biggest allowed capacity in the system. * Undo the change to check_misfit_status() and improve the function to avoid similar confusion in the future. * Split the patches differently. Export the capacity list and sort it is now patch 1, handling of affinity for misfit detection is patch 2. Changes since v3: * Update commit message of patch 2 to be less verbose Changes since v2: * Convert access of asym_cap_list to be rcu protected * Add new patch to sort the list in descending order * Move some declarations inside affinity check block * Remove now redundant check against max_cpu_capacity in check_misfit_status() Changes since v1: * Use asym_cap_list (thanks Dietmar) to iterate instead of iterating through every cpu which Vincent was concerned about. * Use uclamped util to compare with capacity instead of util_fits_cpu() when iterating through capcities (Dietmar). * Update commit log with test results to better demonstrate the problem v1 discussion: https://lore.kernel.org/lkml/20230820203429.568884-1-qyousef@layalina.io/ v2 discussion: https://lore.kernel.org/lkml/20231212154056.626978-1-qyousef@layalina.io/ v3 discussion: https://lore.kernel.org/lkml/20231231175218.510721-1-qyousef@layalina.io/ v4 discussion: https://lore.kernel.org/lkml/20240105222014.1025040-1-qyousef@layalina.io/ v5 discussion: https://lore.kernel.org/lkml/20240205021123.2225933-1-qyousef@layalina.io/ I ended up adding the patch to prevent increasing balance_interval to the series. The other lb issues discussed in v4 are still pending more debugging. Thanks! -- Qais Yousef Qais Yousef (4): sched/topology: Export asym_capacity_list sched/fair: Check a task has a fitting cpu when updating misfit sched/topology: Remove max_cpu_capacity from root_domain sched/fair: Don't double balance_interval for migrate_misfit include/linux/sched.h | 1 + init/init_task.c | 1 + kernel/sched/fair.c | 90 ++++++++++++++++++++++++++++++++--------- kernel/sched/sched.h | 16 +++++++- kernel/sched/topology.c | 56 +++++++++++++------------ 5 files changed, 113 insertions(+), 51 deletions(-) -- 2.34.1