On Tue, 2007-01-09 at 09:23 +0100, [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to