lkml.org 
[lkml]   [2011]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [RFC][PATCH 2/5] mm: Switch mod_state() to __this_cpu_read()
    From
    Date
    On Tue, 2011-09-20 at 18:51 +0200, Thomas Gleixner wrote:

    > this_cpu_*() is patently wrong. It should be: random_cpu_*() or
    > any_cpu_*(). This way you could have avoided confusion in the first
    > place and made it entirely clear what the interfaces are about.

    Thinking about this, my vote is for "any_cpu_*()". I initially liked my
    own snapshot_cpu_*(), and even random_cpu_*() is humorous. But truly,
    the "any_cpu_*()" has the best meaning. As you really don't seem to care
    about which CPU you access. Sure you can document something like:

    /*
    * Will modify the per cpu data on the current CPU, but there is no
    * guarantee which CPU you may be on, as you can migrate just before
    * or after calling this function. Only the scope of this function
    * will be atomic to the CPU the task is currently on, but no guarantee
    * before or after the function. If you care about that, disable
    * preemption and use the this_cpu_*() variants.
    */

    -- Steve




    \
     
     \ /
      Last update: 2011-09-20 19:11    [W:0.020 / U:64.720 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site