Re: [RFC][PATCH] new timeofday-based soft-timer subsystem

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

 



On 29.04.2005 [16:35:46 -0700], Nishanth Aravamudan wrote:
> * john stultz <[email protected]> [2005-0429 15:45:47 -0700]:
> 
> > All,
> >         This patch implements the architecture independent portion of
> > the time of day subsystem. For a brief description on the rework, see
> > here: http://lwn.net/Articles/120850/ (Many thanks to the LWN team for
> > that clear writeup!)
> 
> I have been working closely with John to re-work the soft-timer subsytem
> to use the new timeofday() subsystem. The following patch attempts to
> being this process. I would greatly appreciate any comments.

I am not sure if anyone has looked at this patch closely, but I have
noticed one issue: My code assumes that all the rounding will be done
internally (rounding up on addition to find to the nearest
timerinterval); however, current interfaces do much of the rounding
before passing on structures on to the soft-timer subsystem, because the
jiffies-based one always rounds down.

This is most clear in sys_nanosleep(). Without any modifications to the
syscall, but with my patch applied, one will see around 5 millisecond
sleeps for a 1 millisecond request. This occurs, I believe, because
jiffies_to_timespec() rounds up once, we add one if there is any value
and then in internally I round up once more. If I rewrite
sys_nanosleep() to use schedule_timeout_nsecs() and thus never convert
from nanoseconds, I see 2 millisecond sleeps for 1 millisecond requests,
which is much closer (and accurate, as our granularity is slightly
greater than 1 millisecond and we are interruptiing at HZ=1000 slightly
more often than ever millisecond). This seems to be the right solution,
but then there is another issue: the restart_block used by
sys_nanosleep() only allows for 4 unsigned long arguments, when, in
fact, nanoseconds are a 64-bit quantity in the kernel. As long as the
nanosleep() request is no more than around 4 seconds, we should be ok
using unsigned longs. But anything longer will simply truncate
currently. I am not certain of a clean way to modify the restart_block
to incorporate a 64-bit quantity, as it is used by other interfaces as
well.

I still need to update the other version of nanosleep() (nsleep() and
posix) before I post an updated patch. Just wanted to let everyone know
of the issue.

Thanks,
Nish
-
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