LinuxÄÚ´æ¹ÜÀíÖ®slab·ÖÅäÆ÷·ÖÎö(ÐøÎå)
¾Å£º¼¸µã²¹³ä£º
1: SlabÖÐʹÓõÄÒ³Ãæ¶¼»á¼ÓÉÏ“PG_slab”±êÖ¾£¬ÒÔ¸úÒ»°ãµÄÒ³ÃæÇø±ð¡£ÁíÍ⣬ÔÚÊÍ·ÅÄÚ´æµÄʱºò£¬¾³£ÐèÒªÓõ½´ÓÒ³Ãæµ½slabµÄ¶ÔӦת»»¹ØÏµ¡£ÄÇÊÇÔõÑù±êʶµÄÄØ£¿
¹ØÓÚ±êÖ¾£º
×¢ÒâÓÐÒÔÏ´úÂ룺
static void *kmem_getpages(kmem_cache_t *cachep, int flags, int nodeid)
{
……
while (i--) {
//Ϊ·ÖµÃµÄÿһ¸öÒ³ÃæÉèÖÃPG_slab±êÖ¾
SetPageSlab(page);
page++;
}
……
}
¹ØÓÚ´ÓÒ³Ãæµ½slabµÄת»»£º
Ïò»ï°éϵͳÇëÇóÄÚ´æ
static int cache_grow (kmem_cache_t * cachep, int flags)
{
……
//ÇëÇóÄÚ´æ¹ýºó£¬ÉèÖÃÄÚ´æÊôÐÔ
set_slab_attr(cachep, slabp, objp);
……
}
static void set_slab_attr(kmem_cache_t *cachep, struct slab *slabp, void *objp)
{
int i;
struct page *page;
//¼ÆËãÒ³Ãæ×ÜÊý
i = 1 << cachep->gfporder;
//ÐéÄâµØÖ·×ª»»³ÉÏàÓ¦Ò³Ãæ
page = virt_to_page(objp);
do {
// #define SET_PAGE_CACHE(pg,x) ((pg)->lru.next = (struct list_head *)(x))
SET_PAGE_CACHE(page, cachep);
#define SET_PAGE_SLAB(pg,x) ((pg)->lru.prev = (struct list_head *)(x))
SET_PAGE_SLAB(page, slabp);
page++;
} while (--i);
}
´ÓÉÏÃæµÄº¯
Ïà¹ØÎĵµ£º
Ò»¡¢Ç°ÑÔ
Linux×î³õµÄ¿ª·¢ÍêÈ«ÊÇÎ§ÈÆASCII±àÂëÌåϵ½øÐеģ¬Ã»Óп¼ÂÇ·ÇÓ¢ÓïÓû§ÃæÁÙµÄÎÊÌ⣬Òò´Ëµ¼ÖÂÆäʹÓÃÃż÷½Ï¸ß£¬ÓÈÆä¶ÔÓÚÑÇÖÞÓû§¶øÑÔ£¬ÓÉÓÚ²ÉÓÃÏóÐÎ
ÎÄ×ÖµÄÌØÊâÐÔ£¨°üÀ¨ÖÐÎÄ¡¢º«ÎÄ¡¢ÈÕÎÄ£¬¼ò³ÆÎªCJK£©£¬Ê¹µÃ¶ÔLinux½øÐб¾µØ»¯¸üΪÀ§ÄÑ¡£ÔÚÕâÑùµÄ±³¾°Ï£¬ejoyµÈÈË·¢Æð ......
°æÈ¨ÉùÃ÷£º¿ÉÒÔÈÎÒâ×ªÔØ£¬×ªÔØÊ±ÇëÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://www.5ilinux.com/lamp01.html
¹Ø¼ü×Ö£ºapache+mysql+php apache mysql php ÅäÖà lamp ·þÎñÆ÷ web
Linux+Apache+Mysql+PHPµäÐÍÅäÖÃ
µ÷ÊÔ»·¾³£ºRedhat9.0 Apache1.3.29 Mysql3.23.58 PHP4.3.4
LinuxϵͳµÄ°²×°ÎҾͲ»½²Á ......
1¡¢¼òµ¥²âÊÔʵÀý
for i in `find . -type f -name "*.c"`
do
echo $i
basename $i »ñÈ¡*.cÎļþÃû
dirname $i »ñÈ¡*.c¶ÔÓ¦µÄĿ¼Ãû
done
2¡¢Êµ¼ÊÓ¦ÓÃ
diff LinuxÔ´Â룬²¢½«Óв»Ò»ÑùµÄÔ´ÂëÕûÀíÔÚÒ»Æð£¬ÒªÇó£ºÎļþ ......
¡¡¡¡ÄãÏë³ÉÖªµÀÈçºÎ³ÉΪһ¸öLinuxÄں˿ª·¢Õßô£¿»òÕßÄãµÄÀÏ°å¸æËßÄ㣬“ȥΪÕâ¸öÉ豸дһ¸öLinuxÇý¶¯¡£“ÕâÆªÎĵµµÄÄ¿µÄ£¬¾ÍÊÇͨ¹ýÃèÊöÄãÐèÒª¾ÀúµÄ¹ý³ÌºÍÌáʾÄãÈçºÎºÍÉçÇøÒ»Æð¹¤×÷£¬À´½Ì¸øÄãΪ´ïµ½ÕâЩĿµÄËùÐèÒªÖªµÀµÄËùÓÐ֪ʶ¡£±¾ÎÄÒ²³¢ÊÔ½âÊÍÉçÇøÎªÊ²Ã´ÕâÑù¹¤×÷µÄһЩÔÒò¡£
¡¡¡¡Äں˼¸ºõÈ«ÊÇÓÃCд³ÉµÄ£¬ÓÐ ......
Î壺kmem_cache_create£¨£©·ÖÎö
ÎÒÃÇÒÔÒ»¸öÀý×ÓÀ´¸ú×Ù·ÖÎöÒ»ÏÂslabµÄ»úÖÆ£º
ÏÂÃæÊÇÒ»¸ö²âÊÔÄ£¿éµÄ´úÂ룺
#include <linux/config.h>
#include <linux/module.h>
#include <linux/slab.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("ericxiao <xgr178@163.com>");
MODULE_DESCRI ......