Re: [PATCH] change gen_pool allocator to not touch managed memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/25/06, Dean Nelson <[email protected]> wrote:
> The following patch modifies the gen_pool allocator (lib/genalloc.c) to
> utilize a bitmap scheme instead of the buddy scheme. The purpose of this
> change is to eliminate the touching of the actual memory being allocated.
>
> Since the change modifies the interface, a change to the uncached
> allocator (arch/ia64/kernel/uncached.c) is also required.
>
[snip]

A few small comments below.

> -unsigned long gen_pool_alloc(struct gen_pool *poolp, int size)
> +int gen_pool_add(struct gen_pool *pool, unsigned long addr, size_t size,
> +                int nid)
>  {
> -       int j, i, s, max_chunk_size;
> -       unsigned long a, flags;
> -       struct gen_pool_link *h = poolp->h;
> +       struct gen_pool_chunk *chunk;
> +       int nbits = size >> pool->min_alloc_order;
> +       int nbytes = sizeof(struct gen_pool_chunk) +
> +                               (nbits + BITS_PER_BYTE - 1) / BITS_PER_BYTE;
> +
> +       if (nbytes > PAGE_SIZE) {
> +               chunk = vmalloc_node(nbytes, nid);
> +       } else {
> +               chunk = kmalloc_node(nbytes, GFP_KERNEL, nid);
> +       }

No curly braces when not needed is usually prefered.

       if (nbytes > PAGE_SIZE)
               chunk = vmalloc_node(nbytes, nid);
       else
               chunk = kmalloc_node(nbytes, GFP_KERNEL, nid);


> +static int
> +uncached_add_chunk(struct gen_pool *pool, int nid)

Why not

 +static int uncached_add_chunk(struct gen_pool *pool, int nid)

There's room for it on one line and other functions in that file use
just one line (more grep'able)...


>  void
> -uncached_free_page(unsigned long maddr)
> +uncached_free_page(unsigned long uc_addr)

Move this to a single line perhaps?

 +void uncached_free_page(unsigned long uc_addr)


> +static int __init
> +uncached_init(void)

One line ?


--
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux