lkml.org 
[lkml]   [2004]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: Writable module parameters - should be volatile?
    From
    Date
    On Sun, 2004-09-12 at 21:57, Duncan Sands wrote:
    > I declare a writable module parameter as follows:
    >
    > static unsigned int num_rcv_urbs = UDSL_DEFAULT_RCV_URBS;
    >
    > module_param (num_rcv_urbs, uint, S_IRUGO | S_IWUSR);
    >
    > Shouldn't I declare num_rcv_urbs volatile? Otherwise compiler
    > optimizations could (for example) stick it in a register and miss
    > any changes made by someone writing to it...

    Sure. If it really matters, you're going to need something stronger
    than that, eg module_param_call(). For debugging, it's not usually a
    problem. For more complex parameters, you usually need locks anyway.

    Cheers,
    Rusty.
    --
    Anyone who quotes me in their signature is an idiot -- Rusty Russell

    -
    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 14:06    [W:5.137 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site