Skip to contentSkip to conversation

cpufreq: ACPI: Replace udelay() with usleep_range()

PATCH Applied Kaushlendra Kumar 2 participants 2 messages Nov 19, 2025 – Nov 20, 2025 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cpufreq: ACPI: Replace udelay() with usleep_range()

Replace udelay() with usleep_range() in check_freqs() to allow CPU scheduling during frequency polling. This change improves system responsiveness and avoides busy-waiting.

---
v2:
- Tighten sleep range to usleep_range(10, 15) to limit worst-case loop duration to 1.5ms, addressing reviewer concern about increased latency.
- Cleanup commit message

 drivers/cpufreq/acpi-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/acpi-cpufreq.c +1 -1
index 083d8369a591..e73a66785d69 100644
@@ -395,7 +395,7 @@ static unsigned int check_freqs(struct cpufreq_policy *policy,
 		cur_freq = extract_freq(policy, get_cur_val(mask, data));
 		if (cur_freq == freq)
 			return 1;
-		udelay(10);
+		usleep_range(10, 15);
 	}
 	return 0;
 }
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 20 lines · Kaushlendra Kumar

Replace udelay() with usleep_range() in check_freqs() to allow CPU scheduling during frequency polling. This change improves system responsiveness and avoides busy-waiting.

---
v2:
- Tighten sleep range to usleep_range(10, 15) to limit worst-case loop duration to 1.5ms, addressing reviewer concern about increased latency.
- Cleanup commit message

 drivers/cpufreq/acpi-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/acpi-cpufreq.c +0 -0
index 083d8369a591..e73a66785d69 100644

drivers/cpufreq/acpi-cpufreq.c static unsigned int check_freqs(struct cpufreq_policy *policy,

Quoted 9 lines
drivers/cpufreq/acpi-cpufreq.c +1 -2
@@ -395,7 +395,7 @@ static unsigned int check_freqs(struct cpufreq_policy *policy,
                cur_freq = extract_freq(policy, get_cur_val(mask, data));
                if (cur_freq == freq)
                        return 1;
-               udelay(10);
+               usleep_range(10, 15);
        }
        return 0;
 }
--

Applied as 6.19 material, thanks!