lkml.org 
[lkml]   [2009]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] cpumask: alloc blank cpumask left over
    so sth like

    ---
    include/linux/cpumask.h | 15 +++++++++++++++
    lib/cpumask.c | 12 ++++++++++++
    2 files changed, 27 insertions(+)

    Index: linux-2.6/include/linux/cpumask.h
    ===================================================================
    --- linux-2.6.orig/include/linux/cpumask.h
    +++ linux-2.6/include/linux/cpumask.h
    @@ -1022,6 +1022,8 @@ typedef struct cpumask *cpumask_var_t;

    bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
    bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
    +bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
    +bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
    void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
    void free_cpumask_var(cpumask_var_t mask);
    void free_bootmem_cpumask_var(cpumask_var_t mask);
    @@ -1040,6 +1042,19 @@ static inline bool alloc_cpumask_var_nod
    return true;
    }

    +static inline bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
    +{
    + cpumask_clear(*mask);
    + return true;
    +}
    +
    +static inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
    + int node)
    +{
    + cpumask_clear(*mask);
    + return true;
    +}
    +
    static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
    {
    }
    Index: linux-2.6/lib/cpumask.c
    ===================================================================
    --- linux-2.6.orig/lib/cpumask.c
    +++ linux-2.6/lib/cpumask.c
    @@ -119,6 +119,12 @@ bool alloc_cpumask_var_node(cpumask_var_
    }
    EXPORT_SYMBOL(alloc_cpumask_var_node);

    +bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
    +{
    + return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, node);
    +}
    +EXPORT_SYMBOL(zalloc_cpumask_var_node);
    +
    /**
    * alloc_cpumask_var - allocate a struct cpumask
    * @mask: pointer to cpumask_var_t where the cpumask is returned
    @@ -135,6 +141,12 @@ bool alloc_cpumask_var(cpumask_var_t *ma
    }
    EXPORT_SYMBOL(alloc_cpumask_var);

    +bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
    +{
    + return alloc_cpumask_var(mask, flags | __GFP_ZERO);
    +}
    +EXPORT_SYMBOL(zalloc_cpumask_var);
    +
    /**
    * alloc_bootmem_cpumask_var - allocate a struct cpumask from the bootmem arena.
    * @mask: pointer to cpumask_var_t where the cpumask is returned

    \
     
     \ /
      Last update: 2009-06-06 13:01    [W:0.049 / U:0.196 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site