[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1202160845320.25847@router.home>
Date: Thu, 16 Feb 2012 08:51:53 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Xi Wang <xi.wang@...il.com>
cc: Pekka Enberg <penberg@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Dan Carpenter <dan.carpenter@...cle.com>,
Jesper Juhl <jj@...osbits.net>, Jens Axboe <axboe@...nel.dk>,
linux-kernel@...r.kernel.org, Matt Mackall <mpm@...enic.com>,
David Rientjes <rientjes@...gle.com>
Subject: Re: Uninline kcalloc
On Wed, 15 Feb 2012, Xi Wang wrote:
> On Feb 15, 2012, at 2:34 PM, Christoph Lameter wrote:
> > Any allocation larger than MAX_ORDER << PAGE_SHIFT will fail since the
> > page allocator cannot serve larger contigous pages.
>
> Yes, any number larger than KMALLOC_MAX_SIZE would do the trick.
> The question is whether people would like to adopt
>
> kmalloc(ARRAY_BYTES(n, size), ...);
Well it would be f.e.
kmalloc_node(calculate_array_size(sizeof(struct bla), n), GFP_KERNEL, my_numa_node)
or
vmalloc(calculate_array_size(sizeof(struct blu), n));
Then there is
vzalloc
kzalloc
vmalloc_32
alloc_bootmem (MAXORDER limit may not work)
alloc_remap
...
This would also work for special subsystem allocations like
usb_alloc_coherent
dm_vcalloc
devres_alloc
....
The use of a function or macro makes the overflow check much more
universal and allows these array allocations to occur with different
allocation functions throughout the kernel.
Please do not increase the number of allocation functions needlessly with
new variants.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists