[lkml]   [2003]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] Add SELinux module to 2.5.74-bk1
    James Morris <> wrote:
    > +int hashtab_replace(struct hashtab *h, void *key, void *datum,
    > + void (*destroy)(void *k, void *d, void *args),
    > + void *args)
    > +{
    > ...
    > + newnode = kmalloc(sizeof(*newnode), GFP_KERNEL);

    From an API perspective, the GFP_KERNEL is a problem. Particularly as this
    code seems to require that the caller perform the locking?

    The GFP_KERNEL means that the locking _has_ to be via a sleeping lock
    rather than a spinlock, and interrupt-time insertions are not possible.

    Would be better to pass in the gfp_flags.

    Comparing the complexity (size) of this code with the q-n-d hash tables
    which are currently used one does wonder how useful it all will be. The
    additional indirections are not needed with q-n-d hashes.

    But if it doesn't significantly add to the overall selinux patch then I
    guess it makes sense.

    A slab cache for hashtab_nodes would probably save a bit of space.

    otoh: It would be faster and more space-efficient to require that the
    clients of ths code embed a hastab_node inside their structures and just
    pass the address of that hastab_node into here. When they do a lookup they
    retreive their original struct with container_of. That fixes the GFP_KERNEL
    thing too.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

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