前言
vmalloc()一般为只为软件中(没有对应的硬件意义)的较大的顺序缓存区分配内存,vmalloc()远大于__get_free_pages()的开销,新的页表项需要建立,调用vmalloc来分配少量的内存是不妥的。
vmalloc()分配一块非连续的地址空间,它分配的物理地址一般部不连续,但是虚拟地址是连续的,分配的内存空间被映射进入内存数据中,用户空间不可见.
voidvmalloc(unsigned long size);
void vfree(voidaddr);
二、使用步骤
1.vmalloc使用如下
代码如下(示例):
```c
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/kernel.h>
#include <linux/init.h>
static unsigned char* edid ;
static const unsigned char vivid_hdmi_edid[256] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00,
0x22, 0x1a, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78,
0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26,
0x0f, 0x50, 0x54, 0x2f,