CINXE.COM

LKML: "Rafael J. Wysocki": [RFT][PATCH v1 0/5] cpuidle: menu: Avoid discarding useful information when processing recent idle intervals

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: "Rafael J. Wysocki": [RFT][PATCH v1 0/5] cpuidle: menu: Avoid discarding useful information when processing recent idle intervals</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by &quot;Rafael J. Wysocki&quot;" href="/groupie.php?aid=" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2025"> [2025]</a> 聽 <a class="nb" href="/lkml/2025/2"> [Feb]</a> 聽 <a class="nb" href="/lkml/2025/2/6"> [6]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2025/2/6/927" onclick="this.href='/lkml/headers'+'/2025/2/6/927';">[headers]</a>聽 <a href="/lkml/bounce/2025/2/6/927">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2025/2/6/927">First message in thread</a></li><li class="origin"><a href="/lkml/2025/2/6/923">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2025/2/6/923">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2025/2/17/790">Christian Loehle</a></li></ul></li><li><a href="/lkml/2025/2/6/924">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2025/2/17/866">Christian Loehle</a><ul><li><a href="/lkml/2025/2/17/880">"Rafael J. Wysocki"</a></li></ul></li></ul></li><li><a href="/lkml/2025/2/6/925">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2025/2/17/853">Christian Loehle</a></li></ul></li><li><a href="/lkml/2025/2/6/926">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2025/2/17/804">Christian Loehle</a></li></ul></li><li><a href="/lkml/2025/2/6/928">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2025/2/6/961">Christian Loehle</a></li></ul></li><li><a href="/lkml/2025/2/7/1027">Artem Bityutskiy</a><ul><li><a href="/lkml/2025/2/7/1103">Christian Loehle</a><ul><li><a href="/lkml/2025/2/7/1115">"Rafael J. Wysocki"</a></li></ul></li><li><a href="/lkml/2025/2/7/1157">"Rafael J. Wysocki"</a></li></ul></li><li><a href="/lkml/2025/2/10/922">Christian Loehle</a><ul><li><a href="/lkml/2025/2/10/965">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2025/2/10/972">Christian Loehle</a></li></ul></li><li><a href="/lkml/2025/2/18/1941">Christian Loehle</a><ul><li><a href="/lkml/2025/2/19/773">"Rafael J. Wysocki"</a></li></ul></li></ul></li><li><a href="/lkml/2025/2/13/1996">"Doug Smythies"</a><ul><li><a href="/lkml/2025/2/14/1548">"Rafael J. Wysocki"</a><ul><li><a href="/lkml/2025/2/16/278">"Doug Smythies"</a></li></ul></li></ul></li><li><a href="/lkml/2025/2/24/221">Aboorva Devarajan</a><ul><li><a href="/lkml/2025/2/24/240">Aboorva Devarajan</a></li><li><a href="/lkml/2025/2/24/1038">"Rafael J. Wysocki"</a></li><li><a href="/lkml/2025/2/26/233">Aboorva Devarajan</a><ul><li><a href="/lkml/2025/2/26/773">Christian Loehle</a></li></ul></li></ul></li></ul></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">From</td><td class="rp" itemprop="author">"Rafael J. Wysocki" &lt;&gt;</td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">[RFT][PATCH v1 0/5] cpuidle: menu: Avoid discarding useful information when processing recent idle intervals</td></tr><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Thu, 06 Feb 2025 15:21:58 +0100</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">Hi Everyone,<br /><br />This work had been triggered by a report that commit 0611a640e60a ("eventpoll:<br />prefer kfree_rcu() in __ep_remove()") had caused the critical-jOPS metric of<br />the SPECjbb 2015 benchmark [1] to drop by around 50% even though it generally<br />reduced kernel overhead. Indeed, it was found during further investigation<br />that the total interrupt rate while running the SPECjbb workload had fallen as<br />a result of that commit by 55% and the local timer interrupt rate had fallen by<br />almost 80%.<br /><br />That turned out to cause the menu cpuidle governor to select the deepest idle<br />state supplied by the cpuidle driver (intel_idle) much more often which added<br />significantly more idle state latency to the workload and that led to the<br />decrease of the critical-jOPS score.<br /><br />Interestingly enough, this problem was not visible when the teo cpuidle<br />governor was used instead of menu, so it appeared to be specific to the<br />latter. CPU wakeup event statistics collected while running the workload<br />indicated that the menu governor was effectively ignoring non-timer wakeup<br />information and all of its idle state selection decisions appeared to be<br />based on timer wakeups only. Thus, it appeared that the reduction of the<br />local timer interrupt rate caused the governor to predict a idle duration<br />much more often while running the workload and the deepest idle state was<br />selected significantly more often as a result of that.<br /><br />A subsequent inspection of the get_typical_interval() function in the menu<br />governor indicated that it might return UINT_MAX too often which then caused<br />the governor's decisions to be based entirely on information related to timers.<br /><br />Generally speaking, UINT_MAX is returned by get_typical_interval() if it<br />cannot make a prediction based on the most recent idle intervals data with<br />sufficiently high confidence, but at least in some cases this means that<br />useful information is not taken into account at all which may lead to<br />significant idle state selection mistakes. Moreover, this is not really<br />unlikely to happen.<br /><br />One issue with get_typical_interval() is that, when it eliminates outliers from<br />the sample set in an attempt to reduce the standard deviation (and so improve<br />the prediction confidence), it does that by dropping high-end samples only,<br />while samples at the low end of the set are retained. However, the samples<br />at the low end very well may be the outliers and they should be eliminated<br />from the sample set instead of the high-end samples. Accordingly, the<br />likelihood of making a meaningful idle duration prediction can be improved<br />by making it also eliminate low-end samples if they are farther from the<br />average than high-end samples. This is done in patch [4/5].<br /><br />Another issue is that get_typical_interval() gives up after eliminating 1/4<br />of the samples if the standard deviation is still not as low as desired (within<br />1/6 of the average or within 20 us if the average is close to 0), but the<br />remaining samples in the set still represent useful information at that point<br />and discarding them altogether may lead to suboptimal idle state selection.<br /><br />For instance, the largest idle duration value in the get_typical_interval()<br />data set is the maximum idle duration observed recently and it is likely that<br />the upcoming idle duration will not exceed it. Therefore, in the absence of<br />a better choice, this value can be used as an upper bound on the target<br />residency of the idle state to select. Patch [5/5] works along these lines,<br />but it takes the maximum data point remaining after the elimination of<br />outliers.<br /><br />The first two patches in the series are straightforward cleanups (in fact,<br />the first patch is kind of reversed by patch [4/5], but it is there because<br />it can be applied without the latter) and patch [3/5] is a cosmetic change<br />made in preparation for the subsequent ones.<br /><br />This series turns out to restore the SPECjbb critical-jOPS metric on affected<br />systems to the level from before commit 0611a640e60a and it also happens to<br />increase its max-jOPS metric by around 3%.<br /><br />For easier reference/testing it is present in the git branch at<br /><br /><a href="https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/log/?h=experimental/menu">https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/log/?h=experimental/menu</a><br /><br />based on the cpuidle material that went into 6.14-rc1.<br /><br />If possible, please let me know if it works for you.<br /><br />Thanks!<br /><br /><br />[1] Link: <a href="https://www.spec.org/jbb2015/">https://www.spec.org/jbb2015/</a><br /><br /><br /><br /><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2025-02-06 15:32 聽聽 [W:1.058 / U:1.539 seconds]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10