lkml.org 
[lkml]   [2001]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [Patch] Re: Nasty suprise with uptime
    On Nov 02, 2001  01:28 +0100, Tim Schmielau wrote:
    > Well, I did the next patch without waiting for progress on the stability
    > front (fsck still in heavy use here). As an excercise I added proper
    > locking to get_jiffies64().

    Looks good.

    > idle = init_tasks[0]->times.tms_utime + init_tasks[0]->times.tms_stime;
    > [snip]
    > */
    > #if HZ!=100
    > len = sprintf(page,"%lu.%02lu %lu.%02lu\n",
    > - uptime / HZ,
    > - (((uptime % HZ) * 100) / HZ) % 100,
    > + (unsigned long) uptime,
    > + (remainder * 100) / HZ,
    > idle / HZ,
    > (((idle % HZ) * 100) / HZ) % 100);

    Probably need to make idle a 64-bit value as well, even if the individual
    items are not, just to avoid potential overflow... Calling do_div(idle,HZ)
    may end up being just as fast as the hoops we jump through above to calculate
    the fractions (2 divides, 2 modulus, and one multiply).

    Cheers, Andreas
    --
    Andreas Dilger
    http://sourceforge.net/projects/ext2resize/
    http://www-mddsp.enel.ucalgary.ca/People/adilger/

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

    \
     
     \ /
      Last update: 2005-03-22 13:12    [W:0.025 / U:92.044 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site