From patchwork Sun Feb 4 04:46:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 19896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp197116dyb; Sat, 3 Feb 2024 20:46:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcpjWZoWX9Ffrl0F2rMjOeMQrxyOJ7UyN5zGKXYFiEeaYSuWtg3qeoJFjwBZ53E9agQ7kL X-Received: by 2002:a17:906:7fd7:b0:a35:668a:e9eb with SMTP id r23-20020a1709067fd700b00a35668ae9ebmr6994300ejs.31.1707022015526; Sat, 03 Feb 2024 20:46:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707022015; cv=pass; d=google.com; s=arc-20160816; b=iETdisFQQfrm8KqbGdHCJeKy7hMicztFHGU+GCToj830TTZu+S3b+AYarILKcdg2sc TGTE0x7iJQhAWBSaIQ+YEyNEwSQSb6uSIHXXQzls0daYFCpW06dnF9/VvoijtnQoefHi wLHp5lk2eTRCr+S7rEDquronc/bF7tVPW7Y8OtgRxy3ByRhJJnADUBhbeyRWd0OhlKIT vb9uTv8bMqaxqmesLTlQIdpIO4cA53zeQ1qkEszKw251supz3rXVv0Wne3+MJmhHbSJy Dy/fHWpjhnGCrJOOlylk+lJKRPSIWKlkW+efZ8yJhaPfMMvfh/+eNPFw/Sataan8MV8d QItw== 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=Sgk9HIehH/FlOu1SjzbBQijTyGxDYUXPphKWmkS4u9M=; b=zGu7C2wGts6ntGvegSikY+iox4AN6yCNsTQy02wx6x5tExrX8BjjFgi5ek6oRqGSq9 +Kfkt3oBmsuRAqXtpXAuHdFM1262hsYdK4Er+xan9ortTAQzS5nIwUPJQB9Ow93TVglt u0tgj6/SLLrMxxP2/EkExAoIG1Eq6MB9HDDQ6pUIExnNvhXpcOREVHWibtD4oXsN4vl8 +Iz/V3ZwU6y+/RCdC3IucBGEoJIG95arNpT3g9KCmOGLWlGgdtt3ZnviQ0qmqRQMtOtv F1+QAdzRdVUUHJizj0e7bpMM6BhU5g9kHOmHmswLbyTGiQD9/89m4l9fWKRJM+Qr/e1Z wg2g==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51426-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXJ7O61o2z2UECLG2BXLBMofOurf6v7eErH07yCi7CfqCT53PZys/j5qhKekfxl0k/gdJWopeRp6v/Yq6rvvKp38ahmNQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y3-20020a170906558300b00a3670d3e1dasi2518319ejp.166.2024.02.03.20.46.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 20:46:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51426-ouuuleilei=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; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-51426-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51426-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 1CBF91F22A1C for ; Sun, 4 Feb 2024 04:46:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5178779F4; Sun, 4 Feb 2024 04:46:37 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789942317049213016 X-GMAIL-MSGID: 1789942317049213016 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(-)