[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1168351537.3180.270.camel@laptopd505.fenrus.org>
Date: Tue, 09 Jan 2007 06:05:37 -0800
From: Arjan van de Ven <arjan@...radead.org>
To: thomas@...gstengraphics.com
Cc: davej@...hat.com, linux-kernel@...r.kernel.org, arlied@...il.com
Subject: Re: [PATCH] agpgart: Allow drm-populated agp memory types
On Tue, 2007-01-09 at 09:23 +0100, thomas@...gstengraphics.com wrote:
> +
> +void agp_vkmalloc(size_t size, unsigned long **addr, u8 *vmalloc_flag)
> +{
> + void *tmp = NULL;
> +
> + *vmalloc_flag = 0;
> +
> + if (size <= 2*PAGE_SIZE) {
> + tmp = kmalloc(size, GFP_KERNEL);
> + }
> + if (tmp == NULL) {
> + tmp = vmalloc(size);
> + *vmalloc_flag = 1;
> + }
> +
> + *addr = tmp;
> +}
> +EXPORT_SYMBOL(agp_vkmalloc);
if you don't do this "fallback" thing the caller can just know it is
vmalloc due to the size... (and a 2 page kmalloc isn't going to fail on
you with GFP_KERNEL; also if you really want to deal with this failure
also tell the VM you're ok with failure (__GFP_NORETRY and such)...
but unless you do, things get a lot simpler by not doing this "fall
back" thing.
--
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org
-
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