This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH -mm] relayfs: support larger relay buffer take 2
- From: Pekka J Enberg <penberg at cs dot helsinki dot fi>
- To: Masami Hiramatsu <mhiramat at redhat dot com>
- Cc: Tom Zanussi <zanussi at comcast dot net>, David Wilder <dwilder at us dot ibm dot com>, Andrew Morton <akpm at linux-foundation dot org>, systemtap-ml <systemtap at sources dot redhat dot com>, LKML <linux-kernel at vger dot kernel dot org>, tzanussi at gmail dot com
- Date: Wed, 16 Apr 2008 21:21:09 +0300 (EEST)
- Subject: Re: [PATCH -mm] relayfs: support larger relay buffer take 2
- References: <4804C95F.2080204@redhat.com> <1208319769.7893.16.camel@charm-linux> <48063F80.9060404@redhat.com>
Hi Masami,
On Wed, 16 Apr 2008, Masami Hiramatsu wrote:
> +static struct page *relay_alloc_page_array(unsigned int n_pages)
> +{
> + struct page *array;
> + unsigned int pa_size = n_pages * sizeof(struct page *);
> +
> + if (pa_size > PAGE_SIZE) {
> + array = vmalloc(pa_size);
> + if (array)
> + memset(array, 0, pa_size);
> + } else {
> + array = kcalloc(n_pages, sizeof(struct page *), GFP_KERNEL);
> + }
> + return array;
> +}
I think it's bit confusing to have relay_alloc_page_array() return a
pointer to struct page as it's really allocating an _array_ of pointers to
struct page. So why not just use void * here as the kernel memory
allocators do?
> +static void relay_free_page_array(struct page *array)
> +{
> + if (is_vmalloc_addr(array))
> + vfree(array);
> + else
> + kfree(array);
> +}
Here as well.