From patchwork Mon Feb 5 22:33:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 19966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1188115dyb; Mon, 5 Feb 2024 14:34:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1GrH3J9lVEpAcQeBdQydc2ALIt11XJ9w+Ko4xxt8+Sjf5kCkGk9GMXDV0vXjxU8kIFO9x X-Received: by 2002:a05:6402:7c5:b0:560:87f:3215 with SMTP id u5-20020a05640207c500b00560087f3215mr467014edy.12.1707172464232; Mon, 05 Feb 2024 14:34:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707172464; cv=pass; d=google.com; s=arc-20160816; b=ytymBeApciz3E33lqe2q8Rmcg1eQthIWyDT5S+5lLMY3jQCkz0ddT5Him/Dm5dv3yq p50A+9C0PO9p+zEjHta2aue2HiLhO4O2TWyH6VeLhprIWxMDxP4gnktCxmQcaWPFOg38 Br34xuDUUNbtuaPiOqUmUvJKJm2hI/ju+dHz9vNr2CKgRh6kYlaRwRpSJtiZkIvOo6fX Mv3ow/SX6KxokF90S7MjQILQFNkrxfS7sgy0RsoChWvB61a+JwHlOdHRoxYFvO7VA2FI SWMyIPOGerh7QF3QhQWHi4hLtzIm2e2Pgykn6utxU7nR8HEI5i+RQ7L7frIJ0bB1fmGJ IzLw== 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=L7hCjIP/ZlisYj2P8Ny4Ne49EXNdosYOS8ChSNNIKhc=; fh=bJJdsZjCar4rJTkq7vNfQauhhPsXwij0wf1ogc+mC2M=; b=bafkFt7fMtRH1PotqE2xGdsIBxVP9JbfQvtlmDLdXe4cH6C4nEn6kFLJZxEi/EjEZK 7KJ7ZxB3yVH+ZFURIfZEZsOD/qL6CFYV/UWYB8U/mInwZVgmca4G2Ue1yfHWq538kFEZ fgkeHMJ9UorZwwcekprzBeoTs91S40FfhQ5f9M3Y4OqYuywx+NAe1GtpcLDNOhYblyXn 3gmFN/dZD40kGeivkT6S5isbk78EiTI5GAOFnLtAgYpYdAdcEWQkE4cdtjBxIbfZTV1X oPd7w0Z4elBWjrEHByJcQ2LDyMZeIWzOA0EfpHGPogs51sYrjuASRESAyHcA4U9dhCVj i+Yw==; 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=mEbSyERp; 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-54020-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54020-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCU0nt9tB9LfF53UmgF6gvJ1JcUIW7fqRV7FsjCo1bFOl5Ilh5+Pz3oQMiKYgN/46tIeb4neAe3CjILHMMwkjAbCDMZyxg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d8-20020aa7ce08000000b0055ff27d6618si346745edv.576.2024.02.05.14.34.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 14:34:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54020-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=mEbSyERp; 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-54020-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54020-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id D36331F29F18 for ; Mon, 5 Feb 2024 22:34:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27ACE482FC; Mon, 5 Feb 2024 22:33:58 +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="mEbSyERp" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 2ADA5C148 for ; Mon, 5 Feb 2024 22:33:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172435; cv=none; b=sTOHUjw5gd8GDzT/5ms6DBmQb1uAFNwgsKNlnyzUJDsm9B1bdOZ2Vj02XXaV38p3S/71RY4FAgRYPN4PxmH/H8gj9yonc4l9cpFXLGvE/C0ez3NqNYxkR/CBNVvbRt4eY+/b7bymb8pazdjJZ1Sn6RLSYE08FbG1TDwfX1VJKUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172435; c=relaxed/simple; bh=oNNAS403WLiBr+jO1UJPGHbjrbcZ8v1K77Kbe41vSO0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=o9wJ10NPPfYWfU/k+FoTw0D6s7ZJ/MytpbSVGcIIzT1vFE63ln7N6UOqoP5CcCuT4MnqkMvLPTbZhojUK4A+h9wnuFe/nqfZytgKLB9cggdAe1jG9yRg0FncRYJneahbQEDmyfQXWf9+NxnLhs3jMmnMXnswjVx6Xr/M+fEi8NQ= 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=mEbSyERp; arc=none smtp.client-ip=209.85.128.53 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-wm1-f53.google.com with SMTP id 5b1f17b1804b1-40f02b8d176so43486025e9.1 for ; Mon, 05 Feb 2024 14:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1707172431; x=1707777231; 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=L7hCjIP/ZlisYj2P8Ny4Ne49EXNdosYOS8ChSNNIKhc=; b=mEbSyERppPrSoKxqkSOrPjDmN3Yu8X5R0PXD+HFfs/47VTwySuP3MyEjWGUYMv+3r8 rR409cqOWnEZPtLpfGWsLfn+96w6zFBbQtMdb0DslxXeoxC5getndASh7yDA9HhC8FYj 0ZTSb2zY/wZ0v6SPO/tNi5NM0N+smnMptEsy1o9bxvz+zmx2LUGy7Dq3kZUbIbQCxWnd mObEgNRxSTWQzBOKGIE3iQqoC+R3XFp4Vzbt/pXoFU3ZlcNuJdWlyDcab4ojVsbMVY6f /UKWiDOdwtrwoge/H0nEztNFXp2QHQSnHi5O6F8Hty4Vvty/jSRAo8zOEAKLhLXEq1Ht sjeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707172431; x=1707777231; 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=L7hCjIP/ZlisYj2P8Ny4Ne49EXNdosYOS8ChSNNIKhc=; b=LzCMHtdQsCFWA2dbBp0EQ3JmPLHa90fO2ETfvzu8R0Jb4elklkNqDkUdxRdW7Dggf3 Y/d/MWkWlUb/sODSkKe0LJQz0BQlnb01Ty6FfTPWgESQtLXv4stiJf8EKaJELVzrwwft Tx/5HWubg7LKEvtNKs7D5Hg5mH8jsMRtDe8b9BZZXmUg+LWr+JPT711tQhJ6xFdzz2X9 Sa9HE28p4yXwzFA4nKm5W3xrcDEqhsNUrQoPHOalujIflwbqoDONR5cg4gYy1vLmB+3O IHozNqRf2V99UA2GfhVOdrMyEWYgVIDy2Q3JRrDyq/tr+oei8l3cMhGFGhZuoWyt6Zk5 dnog== X-Gm-Message-State: AOJu0YxA96hFSJb2SBeVjAryDPhcrhlcFqQrYDG4Cwoe+1yAgmyZc0yO KAwnleJf9hHnjv0uEXh891ICfm2yicRpzAzeyyK3HkDsQtoQOvsIyX5bEhFyqBE= X-Received: by 2002:a05:600c:4f03:b0:40e:fc29:f527 with SMTP id l3-20020a05600c4f0300b0040efc29f527mr905653wmq.31.1707172431355; Mon, 05 Feb 2024 14:33:51 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWRAltZ67oGm+W7mHC52B7tZS1OWBX6FP0z1tBIUvPvMQzrG8tXVQfAFJo8R2r9Ltxkmoxg/DSPk3iRM2Kz6JvwL3EIxZB+MYP9465/T+9J4HaGkVSohT0Z8lQQQSIQMV905oE3wyPC1uD+0+SWpnmoa6ICxwn3veKOCM80V8eHgMngDv8uOGbL+rXV0j+Awsam8BI+Z3ywrra6uHBbmw+lFtuwzl8hYdaLrPt4WFf1e46a611jcYCc0eurkLtjTDZlYqdQvuBaZxUoGHewdObPBMLLlMlEjnEvr9Jkpw== Received: from airbuntu.. (host109-154-238-234.range109-154.btcentralplus.com. [109.154.238.234]) by smtp.gmail.com with ESMTPSA id hi2-20020a05600c534200b0040ef702a338sm9683135wmb.25.2024.02.05.14.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 14:33:50 -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/fair: Remove hardcoded fits_capacity() margin Date: Mon, 5 Feb 2024 22:33:41 +0000 Message-Id: <20240205223344.2280519-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790100074203085237 X-GMAIL-MSGID: 1790100074203085237 This series is split from [1]. I thought it might be simpler to split the series and address the intertwined problems separately as some of them are easier to deal with than others. This series focuses on migration margin only, or the check in fits_capacity(). I realized that I had a bug where I am not taking invariance into account. This addressed now. Commit message in patch 3 has all the details. Patches 1 and 2 add helper functions to convert between time and util. I have issues with my test setup so didn't collect proper power/perf numbers like I did in [1]. I didn't see any bad power impact from preliminary tests. Perf numbers are definitely better. I hope to get some feedback to ensure there are no howlers and I'll collect more data for the next posting. Generally I think this is a step in the right directions and, as I find out as I fix more problems, there are a lot of areas that needs to be revisited and improved but it's hard to fix them all in one go. Particularly the definition of overutilized and improving our energy calculation in feec() and balancing work at wake up and load balancer. [1] https://lore.kernel.org/lkml/20231208002342.367117-1-qyousef@layalina.io/ Cheers --- Qais Yousef Qais Yousef (3): sched/pelt: Add a new function to approximate the future util_avg value sched/pelt: Add a new function to approximate runtime to reach given util sched/fair: Remove magic hardcoded margin in fits_capacity() kernel/sched/core.c | 1 + kernel/sched/fair.c | 42 +++++++++++++++++++++++++++++++++++------- kernel/sched/pelt.c | 43 ++++++++++++++++++++++++++++++++++++++++++- kernel/sched/sched.h | 3 +++ 4 files changed, 81 insertions(+), 8 deletions(-)