Re: [RFC][PATCH] Runtime switching of the idle function [take 2]

From: Andrew Morton
Date: Mon Nov 28 2005 - 22:08:00 EST


Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> This patch creates a directory in /sys/kernel called idle.
>

At no point do you appear to explain _why_ the kernel needs this feature?

> ...
> - pm_idle = pm_idle_save;
> + int tries = 0;
> + int ret;
> + set_idle(NULL);
> + do {
> + if ((ret = unregister_idle(PM_IDLE_NAME)) == 0)
> + break;
> + /*
> + * for some reason the idle function is being used.
> + * Wait a little and then try again.
> + */
> + if (ret == -EINVAL) {
> + printk(KERN_WARNING
> + "ACPI idle function never registered?\n");
> + break;
> + }
> + yield();
> + } while (tries++ < 10);

The use of yield() could be problematic - its semantics are rather
ill-defined. Maybe msleep(1) or something?

What's this loop here for anyway? Looks kludgy.

> + if (tries > 10) {
> + printk(KERN_WARNING
> + "Unable to unresgister ACPI idle function\n");

tpyo

> + memset(&idle_kobj, 0, sizeof(idle_kobj));

There are several memsets of statically allocated structures which are
already all-zero.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/