Message ID | 20240206043921.850302-1-void@manifault.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-54317-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1318459dyb; Mon, 5 Feb 2024 20:39:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiscVrRMyiWdx0oVXQgpD/IShWTbX4ws7sozEteE1ejAqajs92fpO6w+SF8GZ5cTgO09vT X-Received: by 2002:ad4:5dea:0:b0:68c:9b64:459a with SMTP id jn10-20020ad45dea000000b0068c9b64459amr1165798qvb.49.1707194383961; Mon, 05 Feb 2024 20:39:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707194383; cv=pass; d=google.com; s=arc-20160816; b=NQDmDgrTLBmDI2mZQqJeMYdxp3XJpEyt0UrsA5yphMcd0QKnPyrfqfKseLngMcw3Uv lI7gRbdhCoEx3QnRMl6rR418jKPebEEJpQbS+m0oFv2e4+YDGIf4ZpFpK6tsrTpo4JC1 SLj95X1YsR6sAveqZEqpKWhlWu1+sRVHL9Gj+WUMQEkz4wfP9WHgogrgopuepNyBg2CA miiSLeQNnXIfevoHwyVDL1J4/wq0QfnJy+dW3iy/Kj/nz2RuUWVjW0fQp9wkVLO/afu+ SJjUogYMbMHAI/cEsDLZU6VUEXixn+PA1Hi0J6G/Fiv6bmCnJM+DaMkNtFUKdngxART3 P63g== 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=senmCcpb6oQKScIo1AzI4134P39uh3oHZTUrZk50thA=; fh=oI0y2RtM9DTAjaJ12Nqgo+3MGxOC6pZx0Q8DoZ4V1eU=; b=LHcUJWLFSldd/aEr4AXve0WOEFHxyoKXPs5FallDMwKGuxxD+bGY1r71/bCslBXFuk x4yClxtukaii8aqMQbSoAOA0UFZO3pmmbYA+a1cVU1eJnkONvXo6Vg68K53SRbrcAHUd i+o4tgtUtbjru1yPmiRetZTzizstEJWtvLoDIWcYThvQwNVr11AW51Q2WtQsJc4XwvJX Ag5V/I9627u4ldy8O5tURhx79ww8M5kN0SogpeZNVytub9Fmqhgei+fGdoi+HOo2WTvM PROnGFKbeiGqOcjNT2zdx/79BPmJGxxebEas7cVUSj41SEAKjkWO8KfCOVhBf8RyeJBA Ae2w==; 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-54317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54317-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCU+5fu2zy+nzl3k+W4EOxyFPFEzCAjbki8xw2DxVT/CtgXeXp15ShKnsrXBaeYqQlmQtTgH/ECku+lftzEBqJDRR97XXw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e4-20020a056214162400b0068c6bf98c26si1544908qvw.554.2024.02.05.20.39.43 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 20:39:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-54317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54317-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BD07D1C21C40 for <ouuuleilei@gmail.com>; Tue, 6 Feb 2024 04:39:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 605B377F09; Tue, 6 Feb 2024 04:39:30 +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 E54C374E31 for <linux-kernel@vger.kernel.org>; Tue, 6 Feb 2024 04:39:26 +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=1707194368; cv=none; b=JqWVokMPvrqpgrXCQC1OOD2/Xa2zNzmzqYD0wiAjK0gDY3IVgza4Q3+6ZI33UvRLnWx/bbHlRgXye3powqUCUyJE91LQHktO3aXdedxSjWkYdCIKG/TgjmEaDptcNM3LhGCkknLg7sDRE+qHd58YYlSZO04vecuZn3HkFwTBLqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194368; c=relaxed/simple; bh=a6if2PZZMv87pSjoCr0EWpp2lFjAy5zDMNV8AVihP5Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rptoP23BRKKKkTNvX28QFPCknlS7GYsrcy4vrUtjO7Sx8zNXnbFdywIOFOOHK3QrBa0sNt3Qy4DE/e8kskItRZiYfYuS/EyhS+fbTu8veeVoMDP3SCymLvMkzIIRnF2TOY6SVs01QuC19iWVQBPM5S4PX4CIBl+2hnTZs5I130A= 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-42c2998d3a3so9284401cf.3 for <linux-kernel@vger.kernel.org>; Mon, 05 Feb 2024 20:39:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707194365; x=1707799165; 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=senmCcpb6oQKScIo1AzI4134P39uh3oHZTUrZk50thA=; b=FZDOpE7hnTFoIgkpBAoiVyN1OQqJeitujDnJ7OFoLWX2eUAbhQ1brmZYHU5fDN/p37 ySdRFn5MXUoZKvM3MOz3jz2dzr15HZLpCJQrpdLAG/3Te/Dwu6E42l2emPcZFhM85RYG r3a0lSYrmrJdgdXRpCu4BgY98y+BRZd4xvt078FeVje2xnvp/CXXR2B+Y1C4aYkz5vRn 1RFV9v9vU7p4tGGCBZSsmI8gkLac0siaWGPdJGf5MQjmKOQXTKkJmHxVQUMffvP44sW6 3ffUuNiqunpuMnn67Xy1SWJbaMiG/LJ06RSrd2+NGj66A4zYpA+4++/LtOWydLl2ln4C 5GSA== X-Gm-Message-State: AOJu0Yz5RB4/X+8pShidk7Qs21osE6M1KIJwRVB/pb1Rzt2tnU3vyk/o npx7KlCTaq2TIGv5BWZasQOEcdgyJmnF8OVZ1mFXihfXzA7nQKLzoS4IFa9B8XTXTw== X-Received: by 2002:a05:622a:8185:b0:42a:a6fd:33e5 with SMTP id jy5-20020a05622a818500b0042aa6fd33e5mr1017027qtb.37.1707194365333; Mon, 05 Feb 2024 20:39:25 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXiB/kM/9k0t9Nc49a9OC7ywE1hrTybRbXH8tEJiyHXa83FenULXEkz/hixYN+adPd8nYLblZ5MMgGV/YQnm5MdkqQJYzDZ3Uw86h6oGgDa+WVK3yLzbQXAI59fUkJq46OlOgHsSnE78yt0Goim4gAaq8edGHqAiPp7KOzzu4GP8ywKXjbC+B1LavxYQQpTn9Zzpn/yoXp6j+8UgVQ8jfRq+hf7OrrEZi6CSuWf+E6mCsfBFFOw9s3XaBS29+LB3FohzaXfyqXIpT6e7DiKt5+e4Rwyd9h0YgIQldHgFueil8DNJxw= Received: from localhost (c-24-1-27-177.hsd1.il.comcast.net. [24.1.27.177]) by smtp.gmail.com with ESMTPSA id f26-20020ac86eda000000b0042a8c890444sm578466qtv.1.2024.02.05.20.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 20:39:24 -0800 (PST) From: David Vernet <void@manifault.com> 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, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, kernel-team@meta.com Subject: [PATCH v3 0/3] sched/fair: Simplify and optimize update_sd_pick_busiest() Date: Mon, 5 Feb 2024 22:39:18 -0600 Message-ID: <20240206043921.850302-1-void@manifault.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790123058417087613 X-GMAIL-MSGID: 1790123058417087613 |
Series |
sched/fair: Simplify and optimize update_sd_pick_busiest()
|
|
Message
David Vernet
Feb. 6, 2024, 4:39 a.m. UTC
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/ v2: https://lore.kernel.org/all/20240204044618.46100-1-void@manifault.com/ v2 -> v3: - Add Vincent's Reviewed-by tags - Fix stale commit summary sentence (Vincent) 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(-)
Comments
On Mon, Feb 05, 2024 at 10:39:18PM -0600, David Vernet wrote: > update_sd_pick_busiest() (and its caller) has some room for small > optimizations, and some improvements in readability. Hello Peter, hello Ingo, Friendly ping. Is there anything else required for this to land? Thanks, David > > - 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/ > v2: https://lore.kernel.org/all/20240204044618.46100-1-void@manifault.com/ > > v2 -> v3: > - Add Vincent's Reviewed-by tags > - Fix stale commit summary sentence (Vincent) > > 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 >
On Fri, Feb 16, 2024 at 01:44:40PM -0600, David Vernet wrote: > Hello Peter, hello Ingo, > > Friendly ping. Is there anything else required for this to land? Hello, Sending another ping. Thanks, David > > Thanks, > David > > > > > - 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/ > > v2: https://lore.kernel.org/all/20240204044618.46100-1-void@manifault.com/ > > > > v2 -> v3: > > - Add Vincent's Reviewed-by tags > > - Fix stale commit summary sentence (Vincent) > > > > 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 > >