2014-12-03 02:20:10

by Gioh Kim

[permalink] [raw]
Subject: vzalloc과 kzalloc의 성능 차이



GPU DDK?? Ư?? ????ü?? ?޸??? ?Ҵ??? vzalloc???? ?ϰ? ?ֽ??ϴ?.
?? ????ü?? ũ?Ⱑ ????byte???? 16K???? ?پ??մϴ?.

???????? ???? vzalloc?? ?ʹ? ?????? kzalloc???? ?ٲ㺼???ϴ? ?????? ???????ϴ?.
???? vzalloc?? kzalloc???? ?ٲٸ? ?????? ???? ?ְ?????
?ʹ? ū ũ???? ?޸??? ?Ҵ翡 kzalloc?? ???? ?޸??? ????ȭ?? Ŀ?????̰? low-mem?? ?????? ???̰? ??????
?????? ?????? ???ҽ??ϴ?.

?׷??? ???????? ũ???????? kzalloc?? ?ᵵ ?ɱ??ϴ? ?????? ?ϴٰ?
?׳? 2K???? 2K?? ?????ϸ鼭 kmalloc, kzalloc, vzalloc?? ?????غý??ϴ?.

???? ?׳? kzalloc?? kmalloc?̴ϱ? vzalloc???? ?????? ?˾ҽ??ϴ?.
?׷??? 8K ~ 24K ?????????? kzalloc = vzalloc ?̶??? ?????? ???Խ??ϴ?.
?? kzalloc?̳? vzalloc?̳? ?????????? ???? ?ð??? ?????ϴ? ?????? ?ִµ?
?? ???????? memset(0)?? ?־ ?׷??? ?????ϴ?.
??? ?????ϼ????

??·?? ?? ?????? 1?????? ?????? ?Ҵ翡?? vzalloc?? kmalloc???? ?ٲ? ?????Դϴ?.
?׷??? 1?????? ???ϴϱ? ?޸??? ????ȭ???? ?????? ?????????

??????Ź?帳?ϴ?.

ps
?????? H15???忡?? Ŀ?θ? ???õǰ? webos???? ???????? ????
???? ?ε尡 ???? ??Ȳ???? ?????Ǿ????ϴ?.

?׽?Ʈ ?ҽ??Դϴ?.

#include <linux/device.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/cdev.h>
#include <linux/slab.h>

#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/export.h>
#include <asm/io.h>
#include <linux/mm_types.h>
#include <linux/list.h>
#include <linux/vmalloc.h>
#include <linux/time.h>
#include <linux/hrtimer.h>

MODULE_LICENSE("GPL");




#define TEST 100
char *ptr[TEST];

static int __init verify_iondev_init(void)
{
int i;
size_t alloc_size;
ktime_t start, end;

printk("start\n");
for (alloc_size = 2048; alloc_size <= 8*4096; alloc_size += 2048) {
start = ktime_get();
for (i = 0; i < TEST; i++) {
ptr[i] = vzalloc(alloc_size);
}
end = ktime_get();
printk("kzalloc(%d) * %d = %llu\n", alloc_size, TEST, end.tv64 - start.tv64);

for (i = 0; i < TEST; i++) {
vfree(ptr[i]);
}
}

return 0;
}

static void __exit verify_iondev_exit(void)
{
int i;

return ;
}

module_init(verify_iondev_init);
module_exit(verify_iondev_exit);

--
Thanks,
Gioh Kim


Attachments:
kzalloc_vzalloc.png (17.65 kB)