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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2005-11-28 at 19:02 -0800, Andrew Morton wrote:
> Steven Rostedt <[email protected]> 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?

Sorry about that.  This originally came up when we had problems with the
AMD64 x2 in the -rt patch.  It was noted that the TSCs would get very
far out of sync and cause problems.  The way to solve this was to set
idle=poll.  The original patch I sent was to allow the user to change to
idle=poll dynamically.  This way they could switch to the poll_idle and
run there tests (requiring tsc not to drift) and then switch back to the
default idle to save on electricity.

Note: It's been stated that the tsc drift can cause problems with the
vanilla kernel too.

Ingo asked if I could make this more robust and not dependent on
idle_poll.

Maybe Ingo can give a better explanation?

> 
> > ...
> > -		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.

Oops! That was required by some other garbage that I had earlier. I
cleaned up the patch some more, and this is no longer required. (will
remove).

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

Will fix.

> 
> > +	memset(&idle_kobj, 0, sizeof(idle_kobj));
> 
> There are several memsets of statically allocated structures which are
> already all-zero.
> 

:) I'm really paranoid!  OK, I always like to do a memset even when it's
not needed.  I'll purge them too.

Thanks for having a look.

-- Steve


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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux