Re: [Query] cpuidle functions cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler
From: Mohammad Merajul Islam Molla <hidden>
Date: 2014-08-05 08:55:46
Also in:
lkml
ping! Since its been a while. Anyone has any comment on this? Should I go ahead submit a patch? -- Thanks, -Meraj On Thu, Jul 24, 2014 at 9:35 PM, Mohammad Merajul Islam Molla [off-list ref] wrote:
Hi
In drivers/cpuidle/cpuidle.c, there are two functions
cpuidle_install_idle_handler & cpuidle_uninstall_idle_handler.
The names seem confusing to me as they don't install any handler,
rather set 'initialized' variable to 1/0.
In kernel version 3.0, these functions used to look as below where
they installed and uninstalled some handler function (pm_idle) -
void cpuidle_install_idle_handler(void)
{
if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
/* Make sure all changes finished before we switch
to new idle */
smp_wmb();
pm_idle = cpuidle_idle_call;
}
}
void cpuidle_uninstall_idle_handler(void)
{
if (enabled_devices && pm_idle_old && (pm_idle != pm_idle_old)) {
pm_idle = pm_idle_old;
cpuidle_kick_cpus();
}
}
In recent kernel (3.16.0-rc6) , the code for the two mentioned
functions looks as below -
/**
* cpuidle_install_idle_handler - installs the cpuidle idle loop handler
*/
void cpuidle_install_idle_handler(void)
{
if (enabled_devices) {
/* Make sure all changes finished before we switch to
new idle */
smp_wmb();
initialized = 1;
}
}
/**
* cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop
handler
*/
void cpuidle_uninstall_idle_handler(void)
{
if (enabled_devices) {
initialized = 0;
kick_all_cpus_sync();
}
}
There is no idle handler (pm_idle) installed/uninstalled anymore.
So should these functions be renamed now to something -
cpuidle_initialize()/cpuidle_uninitialize()? Also, the comments
should be removed?
--
Thanks,
-Meraj