lkml.org 
[lkml]   [2000]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: (*(unsigned long *)&jiffies)++;
    Date
    From: "Tigran Aivazian" <tigran@sco.COM>
    > On Thu, 6 Jan 2000, Petko Manolov wrote:
    > > Exactly.
    > > "(*(unsigned long *)&jiffies)++" did just "incl jiffies"
    > > at the time and in the place you write it.
    >
    > Ok. Why is it not done for lost_ticks and lost_ticks_system?
    >
    I don't know. I just checked my source archive: linux-1.2.13 uses
    "jiffies++", and 2.0.38 uses "(*(...))".

    I don't know why this cast was added, but it doesn't enforce atomicity on
    SMP computers. _If_ we really need the atomicity, then something like this
    could fix the problem:

    - unsigned long volatile jiffies = 0;
    +atomic_t atomic_jiffies = ATOMIC_INIT(0);

    + #define INC_JIFFIES() atomic_inc(&atomic_jiffies);
    + #defien ADD_JIFFIES(inc) atomci_add(&atomic_jiffies,inc);
    + #define jiffies ((unsigned long) atomic_get(&atomic_jiffies));

    Warning: I never tried that, I didn't check if it will be correct on 64-bit
    archs, ...

    --
    Manfred


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

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