lkml.org 
[lkml]   [2013]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCHSET] idr: implement idr_alloc() and convert existing users
    Tejun Heo <tj@kernel.org> writes:

    > Hello,

    So my first response after looking at the ipc patch is ick.

    Why the deep percpu magic?
    Why don't associate idr_preload with an idr structure.

    When reading code with idr_preload I get this deep down creepy feeling.
    What is this magic that is going on?

    Can't we just put the preload list_head into struct idr make
    idr_preload and idr_preload_end take an idr argument?

    Maybe we can have a special structure we put on the stack that has
    the list_head and the preload state instead.

    The way this works just weirds me out and I really really don't like it.

    I would rather continue to use the existing functions as problematic as
    they are as I don't need a course in deep magic to make sense of them.

    > idr_preload(GFP_KERNEL);
    > spin_lock(lock);
    >
    > id = idr_alloc(idr, ptr, lower_limit, upper_limit, GFP_NOWAIT);
    >
    > spin_unlock(lock);
    > idr_preload_end();
    > if (id < 0)
    > return id;

    Eric


    \
     
     \ /
      Last update: 2013-02-03 15:21    [W:4.093 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site