lkml.org 
[lkml]   [2008]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC] CPUMASK: proposal for replacing cpumask_t
    Peter Zijlstra wrote:
    ...
    >> So in function prototypes:
    >>
    >> cpumask_t function(const cpumask_t *A,
    >> cpumask_t *B,
    >> cpumask_t cpumask_C)
    >>
    >> becomes:
    >>
    >> cpumask_val function(cpumask_t A,
    >> cpumask_var B,
    >> cpumask_t cpumask_C)
    >
    > I guess we have to stick the const into the typedef otherwise we get a
    > const pointer instead of a const array member, right?
    >
    > In which case I much prefer the following names:
    >
    > cpumask_data_t - value
    >
    > const_cpumask_t - pointer to constant value
    > cpumask_t - pointer to value

    There were some comments previously such that we should "imply" that the
    incoming cpumask_t args are const, so the compiler would flag those
    who arbitrarily modify it.

    >
    ...
    >> alloc_cpumask(&mask);
    >
    > Don't you have to deal with allocation errors?

    In a perfect world, no... ;-)
    ...
    >> static inline void alloc_cpumask(cpumask_t *m)
    >> {
    >> cpumask_t d = kmalloc(BYTES_PER_CPUMASK, GFP_KERNEL);
    >> if (no_cpumask(&d))
    >> BUG();
    >
    > yuckery yuck yuck!
    >
    >> *m = d;
    >> }
    >>
    >> static inline void alloc_cpumask_nopanic(cpumask_t *m)
    >> {
    >> cpumask_t d = kmalloc(BYTES_PER_CPUMASK, GFP_KERNEL);
    >>
    >> *m = d;
    >> }
    >
    > gah - at the very least you got the naming wrong, methinks the one
    > panic-ing should have panic in its name - if you really want to persist
    > with that variant.

    Yeah, I rather rushed through the allocation part (yuck indeed ;-).

    There are some other alternatives:

    - reserve one or more of these in the task struct
    - reserve one or more in a per-cpu area
    - setup some kind of allocation pool similar to alloc_bootmem
    - ???

    Thanks,
    Mike


    \
     
     \ /
      Last update: 2008-09-11 17:07    [W:0.023 / U:148.176 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site