lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <547E7363.9060002@lge.com>
Date:	Wed, 03 Dec 2014 11:20:19 +0900
From:	Gioh Kim <gioh.kim@....com>
To:	linux-kernel@...r.kernel.org, kernel-forum@....com
CC:	Sinchul Jung <sinchul.jung@....com>
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

Download attachment "kzalloc_vzalloc.png" of type "image/png" (18076 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ