From patchwork Thu Sep 5 09:26:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Loehle X-Patchwork-Id: 825790 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E68C197A7A; Thu, 5 Sep 2024 09:27:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725528449; cv=none; b=MhjduwIZkVQi+i1avogoXzB2M7JQ3w1EuRWexhD/1vcmvEI5RZFpZ+ckb6FzXHd/+Alzty4kCp0NnQsXKACt0kbdRcsxVAiyFmYt/REkoInD1yk+H5ybkTKCxWkWF80us+8LJkqG2yNLsf9aTJ5q2YXoNKnc/K2qIGIekT0CfrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725528449; c=relaxed/simple; bh=4iXHiaHmMfPlrIg/MR9QkOejr+dGX2C9r+fuICZAqwE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KNBzxl6umBnFOq6IesIcwOxMGsOxeWbRaZVUuWKpb/qOey/tHkoLPPy4N8l+QMRPhQQ9dNiTbQXKBH8DEgdGv9nJWQLOTEbfDURMWXDvQRrIevSwN1CQVGXoYFcQJEMCc2BuwWZhWvYqcQKDLwk4g25CYDQeqBM9GP1xqhVcdWE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C3D11576; Thu, 5 Sep 2024 02:27:53 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.75.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9A68C3F8A4; Thu, 5 Sep 2024 02:27:22 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org, peterz@infradead.org Cc: juri.lelli@redhat.com, mingo@redhat.com, dietmar.eggemann@arm.com, vschneid@redhat.com, vincent.guittot@linaro.org, Johannes.Thumshirn@wdc.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, bvanassche@acm.org, andres@anarazel.de, asml.silence@gmail.com, linux-block@vger.kernel.org, io-uring@vger.kernel.org, qyousef@layalina.io, dsmythies@telus.net, axboe@kernel.dk, Christian Loehle Subject: [RFC PATCH 2/8] cpuidle: Prefer teo over menu governor Date: Thu, 5 Sep 2024 10:26:39 +0100 Message-Id: <20240905092645.2885200-3-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240905092645.2885200-1-christian.loehle@arm.com> References: <20240905092645.2885200-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since menu no longer has the interactivity boost teo works better overall, so make it the default. Signed-off-by: Christian Loehle --- drivers/cpuidle/Kconfig | 5 +---- drivers/cpuidle/governors/menu.c | 2 +- drivers/cpuidle/governors/teo.c | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig index cac5997dca50..ae67a464025a 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -5,7 +5,7 @@ config CPU_IDLE bool "CPU idle PM support" default y if ACPI || PPC_PSERIES select CPU_IDLE_GOV_LADDER if (!NO_HZ && !NO_HZ_IDLE) - select CPU_IDLE_GOV_MENU if (NO_HZ || NO_HZ_IDLE) && !CPU_IDLE_GOV_TEO + select CPU_IDLE_GOV_TEO if (NO_HZ || NO_HZ_IDLE) && !CPU_IDLE_GOV_MENU help CPU idle is a generic framework for supporting software-controlled idle processor power management. It includes modular cross-platform @@ -30,9 +30,6 @@ config CPU_IDLE_GOV_TEO This governor implements a simplified idle state selection method focused on timer events and does not do any interactivity boosting. - Some workloads benefit from using it and it generally should be safe - to use. Say Y here if you are not happy with the alternatives. - config CPU_IDLE_GOV_HALTPOLL bool "Haltpoll governor (for virtualized systems)" depends on KVM_GUEST diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 28363bfa3e4c..c0ae5e98d6f1 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -508,7 +508,7 @@ static int menu_enable_device(struct cpuidle_driver *drv, static struct cpuidle_governor menu_governor = { .name = "menu", - .rating = 20, + .rating = 19, .enable = menu_enable_device, .select = menu_select, .reflect = menu_reflect, diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c index f2992f92d8db..6c3cc39f285d 100644 --- a/drivers/cpuidle/governors/teo.c +++ b/drivers/cpuidle/governors/teo.c @@ -537,7 +537,7 @@ static int teo_enable_device(struct cpuidle_driver *drv, static struct cpuidle_governor teo_governor = { .name = "teo", - .rating = 19, + .rating = 20, .enable = teo_enable_device, .select = teo_select, .reflect = teo_reflect, From patchwork Thu Sep 5 09:26:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Loehle X-Patchwork-Id: 825789 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D5CF197A7A; Thu, 5 Sep 2024 09:27:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725528458; cv=none; b=GnzO9eYNn+7lGgcKStWzvLIk6fAZU6HxeLYlLdmcDPQCsTtvo1yxDYSCD4O2M1nB4NaJKujU0uqEMcgaSAOp+eKf5pas4HFRARsRb///eM08dmFrk1I/7/RulYjknB+nn+/cl7117yu/kAxLU4pXktNNxGpUKkLjR5n2C9hwoZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725528458; c=relaxed/simple; bh=WoLUFlTPkqhx9dGHUiTDC3K2yeV+M3vPQWQiwZWIiQI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iShcu17YaRDW3+JnE4iKnDzW1DRe4h65tAxmGYS9bwpEOD9V5gvi7mbWeAPdeIEnNh+tqQiMayVSanpFGKoIHT1hVL4Rc5UTU7V0Hu6iAbLTKNyp6hSKyn2HNUml0kxoFvVI00gtRhoyHnKqxTIlXwxtZptcbngVeYpUIguMWqU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AEA461063; Thu, 5 Sep 2024 02:28:02 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.75.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D99BE3F73F; Thu, 5 Sep 2024 02:27:31 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org, peterz@infradead.org Cc: juri.lelli@redhat.com, mingo@redhat.com, dietmar.eggemann@arm.com, vschneid@redhat.com, vincent.guittot@linaro.org, Johannes.Thumshirn@wdc.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, bvanassche@acm.org, andres@anarazel.de, asml.silence@gmail.com, linux-block@vger.kernel.org, io-uring@vger.kernel.org, qyousef@layalina.io, dsmythies@telus.net, axboe@kernel.dk, Christian Loehle Subject: [RFC PATCH 4/8] TEST: cpufreq/schedutil: iowait boost cap sysfs Date: Thu, 5 Sep 2024 10:26:41 +0100 Message-Id: <20240905092645.2885200-5-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240905092645.2885200-1-christian.loehle@arm.com> References: <20240905092645.2885200-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a knob to cap applied iowait_boost per sysfs. This is to test for potential regressions. Signed-off-by: Christian Loehle --- kernel/sched/cpufreq_schedutil.c | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 7810374aaa5b..5324f07fc93a 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -11,6 +11,7 @@ struct sugov_tunables { struct gov_attr_set attr_set; unsigned int rate_limit_us; + unsigned int iowait_boost_cap; }; struct sugov_policy { @@ -35,6 +36,8 @@ struct sugov_policy { bool limits_changed; bool need_freq_update; + + unsigned int iowait_boost_cap; }; struct sugov_cpu { @@ -316,6 +319,9 @@ static unsigned long sugov_iowait_apply(struct sugov_cpu *sg_cpu, u64 time, sg_cpu->iowait_boost_pending = false; + if (sg_cpu->iowait_boost > sg_cpu->sg_policy->iowait_boost_cap) + sg_cpu->iowait_boost = sg_cpu->sg_policy->iowait_boost_cap; + /* * sg_cpu->util is already in capacity scale; convert iowait_boost * into the same scale so we can compare. @@ -554,6 +560,14 @@ static ssize_t rate_limit_us_show(struct gov_attr_set *attr_set, char *buf) return sprintf(buf, "%u\n", tunables->rate_limit_us); } + +static ssize_t iowait_boost_cap_show(struct gov_attr_set *attr_set, char *buf) +{ + struct sugov_tunables *tunables = to_sugov_tunables(attr_set); + + return sprintf(buf, "%u\n", tunables->iowait_boost_cap); +} + static ssize_t rate_limit_us_store(struct gov_attr_set *attr_set, const char *buf, size_t count) { @@ -572,10 +586,30 @@ rate_limit_us_store(struct gov_attr_set *attr_set, const char *buf, size_t count return count; } +static ssize_t +iowait_boost_cap_store(struct gov_attr_set *attr_set, const char *buf, size_t count) +{ + struct sugov_tunables *tunables = to_sugov_tunables(attr_set); + struct sugov_policy *sg_policy; + unsigned int iowait_boost_cap; + + if (kstrtouint(buf, 10, &iowait_boost_cap)) + return -EINVAL; + + tunables->iowait_boost_cap = iowait_boost_cap; + + list_for_each_entry(sg_policy, &attr_set->policy_list, tunables_hook) + sg_policy->iowait_boost_cap = iowait_boost_cap; + + return count; +} + static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us); +static struct governor_attr iowait_boost_cap = __ATTR_RW(iowait_boost_cap); static struct attribute *sugov_attrs[] = { &rate_limit_us.attr, + &iowait_boost_cap.attr, NULL }; ATTRIBUTE_GROUPS(sugov); @@ -765,6 +799,8 @@ static int sugov_init(struct cpufreq_policy *policy) tunables->rate_limit_us = cpufreq_policy_transition_delay_us(policy); + tunables->iowait_boost_cap = SCHED_CAPACITY_SCALE; + policy->governor_data = sg_policy; sg_policy->tunables = tunables; @@ -834,6 +870,8 @@ static int sugov_start(struct cpufreq_policy *policy) sg_policy->limits_changed = false; sg_policy->cached_raw_freq = 0; + sg_policy->iowait_boost_cap = SCHED_CAPACITY_SCALE; + sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS); if (policy_is_shared(policy)) From patchwork Thu Sep 5 09:26:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Loehle X-Patchwork-Id: 825788 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C002198A01; Thu, 5 Sep 2024 09:27:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725528466; cv=none; b=eK4mo0JyIQMWs/iPfVbje9nYg05sMXecCh/4S7W5bkCWPIkzDrHx8u5uJYXc7WtSV/us3xdnVyjduE+/M+y9YOzDLbRyT8DbWYWjBTiST3rC/waQJgWxwQQRqRGbg6FfFzZqssZUZ8Vczb26e75WlypjBf7uEuUxe1nkOchELpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725528466; c=relaxed/simple; bh=apO3ieJCTPZmZT/g1YOS/QvNSR5JN4FNa0CjdLj5DUQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PlhMCNmsYqtdhS8VzevygKx5tpaU2mHlux20ZsocHTWtlovoQGeY+kXPQ+L4wpiz0WzX0bPzypfw6bJEmNuxlXjcIUzCwQnnHxjiYKhJ4sWZq3iCCU+sIwe/cvWF/gWjpbOrlyn4UtXFzJx9/6EYIYGIFBWmiAT0YZHhuKPUBRk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 697021063; Thu, 5 Sep 2024 02:28:11 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.75.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 020CE3F73F; Thu, 5 Sep 2024 02:27:40 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org, peterz@infradead.org Cc: juri.lelli@redhat.com, mingo@redhat.com, dietmar.eggemann@arm.com, vschneid@redhat.com, vincent.guittot@linaro.org, Johannes.Thumshirn@wdc.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, bvanassche@acm.org, andres@anarazel.de, asml.silence@gmail.com, linux-block@vger.kernel.org, io-uring@vger.kernel.org, qyousef@layalina.io, dsmythies@telus.net, axboe@kernel.dk, Christian Loehle Subject: [RFC PATCH 6/8] cpufreq: intel_pstate: Remove iowait boost Date: Thu, 5 Sep 2024 10:26:43 +0100 Message-Id: <20240905092645.2885200-7-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240905092645.2885200-1-christian.loehle@arm.com> References: <20240905092645.2885200-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Analogous to schedutil, remove iowait boost for the same reasons. Signed-off-by: Christian Loehle --- drivers/cpufreq/intel_pstate.c | 50 ++-------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index c0278d023cfc..7f30b2569bb3 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -191,7 +191,6 @@ struct global_params { * @policy: CPUFreq policy value * @update_util: CPUFreq utility callback information * @update_util_set: CPUFreq utility callback is set - * @iowait_boost: iowait-related boost fraction * @last_update: Time of the last update. * @pstate: Stores P state limits for this CPU * @vid: Stores VID limits for this CPU @@ -245,7 +244,6 @@ struct cpudata { struct acpi_processor_performance acpi_perf_data; bool valid_pss_table; #endif - unsigned int iowait_boost; s16 epp_powersave; s16 epp_policy; s16 epp_default; @@ -2136,28 +2134,7 @@ static inline void intel_pstate_update_util_hwp_local(struct cpudata *cpu, { cpu->sample.time = time; - if (cpu->sched_flags & SCHED_CPUFREQ_IOWAIT) { - bool do_io = false; - - cpu->sched_flags = 0; - /* - * Set iowait_boost flag and update time. Since IO WAIT flag - * is set all the time, we can't just conclude that there is - * some IO bound activity is scheduled on this CPU with just - * one occurrence. If we receive at least two in two - * consecutive ticks, then we treat as boost candidate. - */ - if (time_before64(time, cpu->last_io_update + 2 * TICK_NSEC)) - do_io = true; - - cpu->last_io_update = time; - - if (do_io) - intel_pstate_hwp_boost_up(cpu); - - } else { - intel_pstate_hwp_boost_down(cpu); - } + intel_pstate_hwp_boost_down(cpu); } static inline void intel_pstate_update_util_hwp(struct update_util_data *data, @@ -2240,9 +2217,6 @@ static inline int32_t get_target_pstate(struct cpudata *cpu) busy_frac = div_fp(sample->mperf << cpu->aperf_mperf_shift, sample->tsc); - if (busy_frac < cpu->iowait_boost) - busy_frac = cpu->iowait_boost; - sample->busy_scaled = busy_frac * 100; target = READ_ONCE(global.no_turbo) ? @@ -2303,7 +2277,7 @@ static void intel_pstate_adjust_pstate(struct cpudata *cpu) sample->aperf, sample->tsc, get_avg_frequency(cpu), - fp_toint(cpu->iowait_boost * 100)); + 0); } static void intel_pstate_update_util(struct update_util_data *data, u64 time, @@ -2317,24 +2291,6 @@ static void intel_pstate_update_util(struct update_util_data *data, u64 time, return; delta_ns = time - cpu->last_update; - if (flags & SCHED_CPUFREQ_IOWAIT) { - /* Start over if the CPU may have been idle. */ - if (delta_ns > TICK_NSEC) { - cpu->iowait_boost = ONE_EIGHTH_FP; - } else if (cpu->iowait_boost >= ONE_EIGHTH_FP) { - cpu->iowait_boost <<= 1; - if (cpu->iowait_boost > int_tofp(1)) - cpu->iowait_boost = int_tofp(1); - } else { - cpu->iowait_boost = ONE_EIGHTH_FP; - } - } else if (cpu->iowait_boost) { - /* Clear iowait_boost if the CPU may have been idle. */ - if (delta_ns > TICK_NSEC) - cpu->iowait_boost = 0; - else - cpu->iowait_boost >>= 1; - } cpu->last_update = time; delta_ns = time - cpu->sample.time; if ((s64)delta_ns < INTEL_PSTATE_SAMPLING_INTERVAL) @@ -2832,7 +2788,7 @@ static void intel_cpufreq_trace(struct cpudata *cpu, unsigned int trace_type, in sample->aperf, sample->tsc, get_avg_frequency(cpu), - fp_toint(cpu->iowait_boost * 100)); + 0); } static void intel_cpufreq_hwp_update(struct cpudata *cpu, u32 min, u32 max, From patchwork Thu Sep 5 09:26:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Loehle X-Patchwork-Id: 825787 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CB98198A25; Thu, 5 Sep 2024 09:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725528475; cv=none; b=Gtay8WlFsG9Vln3Lxtl6nVbKuG1iG+aU8RBhQ+GanP59lSRSBBtCybEd/jBB8912qo5FXZTzzLVNyy/7caJDcv7+iPBFeocvwfyTQmFV+T5L8x3dwblw+5cigthq3u+nN7dVjQKKza/wsezLdc84sJBbL+eFdYwPYSzHo5iZ2K4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725528475; c=relaxed/simple; bh=HhGLvHqBHzexJqM6r5ytVEg4CW0oOFnrqqKCCerjEA0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YVnj5tappVRgdX/uxzD4Yl+CoZ/LSlViEFI24otws47gMLZnC343pKeD0pB5lD/Lqxzr5HyOTxnapDAvyr5wu2ZptNL/ylr0g/S49vfd99eM8EmXd4o5Yh9vw9IDpJ40n37NnrdlWHQ5BO1aNC1i0R39Y5lxn+vEw4ZnS5eLMpc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 410701063; Thu, 5 Sep 2024 02:28:20 -0700 (PDT) Received: from e127648.arm.com (unknown [10.57.75.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6DA053F73F; Thu, 5 Sep 2024 02:27:49 -0700 (PDT) From: Christian Loehle To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org, peterz@infradead.org Cc: juri.lelli@redhat.com, mingo@redhat.com, dietmar.eggemann@arm.com, vschneid@redhat.com, vincent.guittot@linaro.org, Johannes.Thumshirn@wdc.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, bvanassche@acm.org, andres@anarazel.de, asml.silence@gmail.com, linux-block@vger.kernel.org, io-uring@vger.kernel.org, qyousef@layalina.io, dsmythies@telus.net, axboe@kernel.dk, Christian Loehle Subject: [RFC PATCH 8/8] io_uring: Do not set iowait before sleeping Date: Thu, 5 Sep 2024 10:26:45 +0100 Message-Id: <20240905092645.2885200-9-christian.loehle@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240905092645.2885200-1-christian.loehle@arm.com> References: <20240905092645.2885200-1-christian.loehle@arm.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Setting in_iowait was introduced in commit 8a796565cec3 ("io_uring: Use io_schedule* in cqring wait") to tackle a perf regression that was caused by menu taking iowait into account for synchronous IO and thus not selecting deeper states like in the io_uring counterpart. That behaviour is gone, so the workaround can be removed. Signed-off-by: Christian Loehle --- io_uring/io_uring.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 3942db160f18..c819d40bdcf0 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2341,15 +2341,6 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx) return 0; } -static bool current_pending_io(void) -{ - struct io_uring_task *tctx = current->io_uring; - - if (!tctx) - return false; - return percpu_counter_read_positive(&tctx->inflight); -} - /* when returns >0, the caller should retry */ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, struct io_wait_queue *iowq) @@ -2367,19 +2358,11 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, if (unlikely(io_should_wake(iowq))) return 0; - /* - * Mark us as being in io_wait if we have pending requests, so cpufreq - * can take into account that the task is waiting for IO - turns out - * to be important for low QD IO. - */ - if (current_pending_io()) - current->in_iowait = 1; ret = 0; if (iowq->timeout == KTIME_MAX) schedule(); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) ret = -ETIME; - current->in_iowait = 0; return ret; }