Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1717873rdb; Sat, 3 Feb 2024 20:48:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyaNKjHhsWiO32lz5M65wKOajp2468vNJY66C2icEuda56yIEhsSyECojKUPt3yp8MKTnH X-Received: by 2002:a17:903:248:b0:1d9:657c:2769 with SMTP id j8-20020a170903024800b001d9657c2769mr9236171plh.19.1707022095657; Sat, 03 Feb 2024 20:48:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707022095; cv=pass; d=google.com; s=arc-20160816; b=MRJ+QcFxNm69g2IxiEOB+j8lrGUBi9e6rVywLyaIXLqhY+hKdxKM0kO6SQVeI54QXe H+B7o2Ycf6fYqSQ8pj5VEvJGbclbdeWtft4YuYgnFPetcA1f4KFRecpmJVeQLb5F6ZlW jvK1wWG0dRztbBserA2EmoZqfg95oS5ILBa8C47JOS0rnMwJdBmuYOWaOZz5R4o+GaJY hheAX6jwYqyA7mF+N9XTCbdzoICsrPPwZWxUW9e3ZVjM7WjniCQxOf5/FXMNuy1vfHPA oAlhbc4TTGFyfQBinj6ruCXwyNa3r31f531fSM7BTh52v+HRYBj/mNO8G+iygQ4FhFgX YVMQ== 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; bh=geUmMcTX8p4NRKeidELidreXuEDuXbffq2eplBFLGBM=; fh=4WtLC5XclUZM9qFHBJsT5w4D39cTUr7nurrLhns2350=; b=IP7oipWr4l8oIkQnr5ZX1/4w0KSX8beAX78J1Khx261anIJuN4fJryjDTj7W41GjE2 498TnjLt2D1vkQimjLFZMXmizL9QjX8rYC1h4ay6aQAbjLa+f3yig2IIlDcHF91+gi2v Dcm5J6Zgl00B+i9cFQmfi2kmhUozI+/k/IslQn7JaZzvH8G+a/7G5AI98H5wSvmz4tlU By+s+WZoHCNyeMkqDPvBvBdGDFFAq8bKPrbH2xvxKqLvW4iCN0asq11p1S1TLI23RuZQ XvxiY5RVC+qTCjlyC8f87CgSrZJMkqvWFHv4YpSjIVMQBpni8w68cWfLO8zg8x0n8qEO FIrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-51426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51426-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXPqaVKiGp39EhNtCPosQJCRRUDxmvizbcZDkSfC8E3o2kdKZBBa3984HUqgJH6jbScOA1zNqaPCVGR4ZQQhgJMsfQJ1MhnzkgKi0g7Mw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e4-20020a170902b78400b001d93b220121si4201909pls.91.2024.02.03.20.48.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 20:48:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-51426-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51426-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3CC81B2569F for ; Sun, 4 Feb 2024 04:46:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44DCB7475; Sun, 4 Feb 2024 04:46:36 +0000 (UTC) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 F38666FB9 for ; Sun, 4 Feb 2024 04:46:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707021995; cv=none; b=cE9ePIX5R2r1gwwPOyIXK2ZSuYELslPETMLIXHCzW487ILj4oFeno7Vr7OLGRt5RQHdTP/P0GZcVUvckIxzLtEtvvdtwZXlzUHfHJ9kteLe7VJz+264/hBIz7/+kKsUMJCJdLnwl5He9tpxS+kDCL2y8wS3aNPOTdGaqtW8GNs0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707021995; c=relaxed/simple; bh=pYurAIAdDs3zqLyccEjZYVhP849U5nz3V7/2Uz0E/kE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=PAPd2m8516eyY+/bT40CpXZ19WsBO8M1tf/sjLkbKvodJ9IUs5wN1oeglv6VUeWgQJy9FDpflPVIo6Zr7TtpRObN76a6UCm53kq39BqrLOAfrII+cENpcXCmfVvANjV4gUEKNddhFjnbmeKtwfjiBxDDP1l8aGQZwv7ceSydh7I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=manifault.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=manifault.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-42bf29aff0dso24196371cf.3 for ; Sat, 03 Feb 2024 20:46:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707021992; x=1707626792; 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=geUmMcTX8p4NRKeidELidreXuEDuXbffq2eplBFLGBM=; b=BiO41MWF7dyB+h9XyIgEurt4eQqZhtW3X0LIVoAy9NMTp/JGFhj4G3PG0AMYMTa0OD XQL5HodVE25kAEX3V1N0N47z61n3JV1RrDubTYWOw4Ntu712Oab3mll/jX6MtHq2hVEr 3HOQtnuXmZcAty5WE7dr0OOyMqUqn+352rAsY5DBq1oHpiUwuR0fa6rKlbaLNVXRjPWq rfT9w5N3Gr9a/ylNO5vDX7fLYD/8Hg5Qmv/zeQk69Pcd+20/eD22HYcTaPneEigvZPI8 CJTEVWOKQc1j/Shg2g480sb7mX+DTdhxOcFb6VnVqem09amh1YdROGBwssPmI/thijvD b90w== X-Gm-Message-State: AOJu0YydcbgClOMfEhl5G+LGRWtDV3GTDnlfQoiWxSpbdZkspS3JxJvl ga87jzNYp6LLc5nFdg2Pq8jy8yP3B2Qq9Qhh912noOYXDCISM8RhximYGd681q0= X-Received: by 2002:ac8:4582:0:b0:42b:ef49:5e07 with SMTP id l2-20020ac84582000000b0042bef495e07mr2933315qtn.46.1707021992461; Sat, 03 Feb 2024 20:46:32 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVdDn8OaVbbUDCJRc/x2ofrtYIWuuJr0iQtTx3w4xPSKMjXMv84Ii7mM75I3UKeAl345Ogw52ElOxpzateVykYX6VvVRAjPEVEyX7LuxbxTr5r7m3b0Xq66GVGt1ouX48sPM1gMOAuQEbw9jJeADWwsp+SOItbuDFMrxIFZxuho2ISewWA6YItWy9Dmf+RAO+QYDKDgNRg31JcIxnRmMngrSla9RNs/GoEDp1khQlJK0PBedTso+bkan/A7ze5Drv8+YnGZL9WJ5vcOiIQ2lYo4xaWYQOaUaQ5Drk6O1csfO3iHFbpaIAp4xgHm4jtNJpSW9RBopyNHCeczVrIkcSaEXx/2E5HaI8uArQ== Received: from localhost (c-24-1-27-177.hsd1.il.comcast.net. [24.1.27.177]) by smtp.gmail.com with ESMTPSA id fx12-20020a05622a4acc00b0042a6e6792basm2409321qtb.69.2024.02.03.20.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 20:46:32 -0800 (PST) From: David Vernet To: linux-kernel@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, kernel-team@meta.com Subject: [PATCH v2 0/3] sched/fair: Simplify and optimize update_sd_pick_busiest() Date: Sat, 3 Feb 2024 22:46:15 -0600 Message-ID: <20240204044618.46100-1-void@manifault.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit update_sd_pick_busiest() (and its caller) has some room for small optimizations, and some improvements in readability. - In update_sd_lb_stats(), we're using a goto to skip a single if check. Let's remove the goto and just add another condition to the if. - In update_sd_pick_busiest(), only update a group_misfit_task group to be the busiest if it has strictly more load than the current busiest task, rather than >= the load. - When comparing the current struct sched_group with the yet-busiest domain in update_sd_pick_busiest(), if the two groups have the same group type, we're currently doing a bit of unnecessary work for any group >= group_misfit_task. We're comparing the two groups, and then returning only if false (the group in question is not the busiest). Othewise, we break, do an extra unnecessary conditional check that's vacuously false for any group type > group_fully_busy, and then always return true. This patch series has us instead simply return directly in the switch statement, saving some bytes in load_balance(). --- v1: https://lore.kernel.org/lkml/20240202070216.2238392-1-void@manifault.com/ v1 -> v2 changes: - Split the patch series into separate patches (Valentin) - Update the group_misfit_task busiest check to use strict inequality David Vernet (3): sched/fair: Remove unnecessary goto in update_sd_lb_stats() sched/fair: Do strict inequality check for busiest misfit task group sched/fair: Simplify some logic in update_sd_pick_busiest() kernel/sched/fair.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) -- 2.43.0