Re: [update] Re: [PATCH] PM: Make it possible to avoid wakeup events from being lost

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

 



On Thu, 1 Jul 2010, Rafael J. Wysocki wrote:

> > > +	if (msec) {
> > > +		ktime_t kt;
> > > +		struct timespec ts;
> > > +		unsigned long expires;
> > > +
> > > +		kt = ktime_get();
> > > +		kt = ktime_add_ns(kt, msec * NSEC_PER_MSEC);
> > > +		ts = ktime_to_timespec(kt);
> > > +		expires = timespec_to_jiffies(&ts);
> > 
> > Is this somehow better than jiffies + msecs_to_jiffies(msec)?
> 
> I'm not sure about overflows.  That said, the "+" version is used in many
> places, so there's no problem I think.

Hmm.  NSEC_PER_MSEC must be one million, right?  So if msec referred to
anything above 4 seconds (which seems unlikely but not impossible), the
multiplication would overflow on a 32-bit machine.

Apart from that, the main difference between the two patches lies in
when the events are counted, i.e., whether event_count gets incremented
at the start or when the timer expires.  I can't see that it matters 
much either way.


> Index: linux-2.6/drivers/base/power/wakeup.c
> ===================================================================
> --- linux-2.6.orig/drivers/base/power/wakeup.c
> +++ linux-2.6/drivers/base/power/wakeup.c
> @@ -9,6 +9,7 @@
>  #include <linux/device.h>
>  #include <linux/slab.h>
>  #include <linux/sched.h>
> +#include <linux/ktime.h>

This isn't needed any more.

Alan Stern

_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm


[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux