lkml.org 
[lkml]   [2005]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 2/5] slab: remove unused align parameter from alloc_percpu
    From
    Date

    __alloc_percpu and alloc_percpu both take an 'align' argument which is
    completely ignored. snmp6_mib_init() in net/ipv6/af_inet6.c attempts to
    use it, but it will be ignored. Therefore, remove the 'align' argument
    and fixup the lone caller.

    Signed-off-by: Matthew Dobson <colpatch@us.ibm.com>
    Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
    ---

    include/linux/percpu.h | 7 +++----
    mm/slab.c | 3 +--
    net/ipv6/af_inet6.c | 4 ++--
    3 files changed, 6 insertions(+), 8 deletions(-)

    Index: 2.6/include/linux/percpu.h
    ===================================================================
    --- 2.6.orig/include/linux/percpu.h
    +++ 2.6/include/linux/percpu.h
    @@ -33,14 +33,14 @@ struct percpu_data {
    (__typeof__(ptr))__p->ptrs[(cpu)]; \
    })

    -extern void *__alloc_percpu(size_t size, size_t align);
    +extern void *__alloc_percpu(size_t size);
    extern void free_percpu(const void *);

    #else /* CONFIG_SMP */

    #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })

    -static inline void *__alloc_percpu(size_t size, size_t align)
    +static inline void *__alloc_percpu(size_t size)
    {
    void *ret = kmalloc(size, GFP_KERNEL);
    if (ret)
    @@ -55,7 +55,6 @@ static inline void free_percpu(const voi
    #endif /* CONFIG_SMP */

    /* Simple wrapper for the common case: zeros memory. */
    -#define alloc_percpu(type) \
    - ((type *)(__alloc_percpu(sizeof(type), __alignof__(type))))
    +#define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type))))

    #endif /* __LINUX_PERCPU_H */
    Index: 2.6/mm/slab.c
    ===================================================================
    --- 2.6.orig/mm/slab.c
    +++ 2.6/mm/slab.c
    @@ -2949,9 +2949,8 @@ EXPORT_SYMBOL(__kmalloc);
    * Objects should be dereferenced using the per_cpu_ptr macro only.
    *
    * @size: how many bytes of memory are required.
    - * @align: the alignment, which can't be greater than SMP_CACHE_BYTES.
    */
    -void *__alloc_percpu(size_t size, size_t align)
    +void *__alloc_percpu(size_t size)
    {
    int i;
    struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL);
    Index: 2.6/net/ipv6/af_inet6.c
    ===================================================================
    --- 2.6.orig/net/ipv6/af_inet6.c
    +++ 2.6/net/ipv6/af_inet6.c
    @@ -596,11 +596,11 @@ snmp6_mib_init(void *ptr[2], size_t mibs
    if (ptr == NULL)
    return -EINVAL;

    - ptr[0] = __alloc_percpu(mibsize, mibalign);
    + ptr[0] = __alloc_percpu(mibsize);
    if (!ptr[0])
    goto err0;

    - ptr[1] = __alloc_percpu(mibsize, mibalign);
    + ptr[1] = __alloc_percpu(mibsize);
    if (!ptr[1])
    goto err1;

    -
    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-11-18 18:28    [W:0.023 / U:0.024 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site