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/
[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]