LinuxÄÚ´æ¹ÜÀíÖ®slab·ÖÅäÆ÷·ÖÎö(ÐøÈý)
Áù£ºkmem_cache_allocµÄʵÏÖ·ÖÎö:
ÎÒÃÇÔÚÉÏÃæ¿ÉÒÔ¿´µ½£¬´´½¨Ò»¸öcacheÃèÊö·ûµÄʱºò£¬²¢Ã»ÓÐÕâÖ®·ÖÅäslabÊý¾Ý¡£ÏÖÔÚÎÒÃÇÀ´¿´Ò»ÏÂÔõô´ÓcacheÖÐÉêÇë¶ÔÏó
void * kmem_cache_alloc (kmem_cache_t *cachep, int flags)
{
return __cache_alloc(cachep, flags);
}
ʵ¼ÊÉÏ»áµ÷ÓÃ__cache_alloc
ÈçÏ£º
static inline void * __cache_alloc (kmem_cache_t *cachep, int flags)
{
unsigned long save_flags;
void* objp;
struct array_cache *ac;
//Èç¹û¶¨ÒåÁË__GFP_WAIT¡£¿ÉÄÜ»áÒýÆð˯Ãß
cache_alloc_debugcheck_before(cachep, flags);
local_irq_save(save_flags);
//È¡µÃµ±Ç°´¦ÀíÆ÷ËùÔÚµÄarray_cache(¼ò³ÆΪAC£¬ÎÒÃÇÏÂÃæÒ²ÕâÑù³ÆºôËü)
ac = ac_data(cachep);
//ac->avail:ACÖеںóÒ»¸ö¿ÉÓõĶÔÏóË÷Òý
//Èç¹ûACÖл¹ÓпÉÓõĶÔÏó
if (likely(ac->avail)) {
STATS_INC_ALLOCHIT(cachep);
//ÿ´Î·ÖÅ䶼»á°Ñac->touchedÖÃΪ1
ac->touched = 1;
objp = ac_entry(ac)[--ac->avail];
} else {
//Èç¹ûACÖÐûÓпÉÓöÔÏó£¬ÄÇÖ»ÄÜ´Ól3ÖГ°á³ö”¶ÔÏóµ½ACÖÐ
STATS_INC_ALLOCMISS(cachep);
objp = cache_alloc_refill(cachep, flags);
}
local_irq_restore(save_flags);
objp = cache_alloc_debugcheck_after(cachep, flags, objp, __builtin_return_address(0));
return objp;
}
Ê
Ïà¹ØÎĵµ£º
Ò»¡¢Ç°ÑÔ
Linux×î³õµÄ¿ª·¢ÍêÈ«ÊÇΧÈÆASCII±àÂëÌåϵ½øÐеģ¬Ã»Óп¼ÂÇ·ÇÓ¢ÓïÓû§ÃæÁÙµÄÎÊÌ⣬Òò´Ëµ¼ÖÂÆäʹÓÃÃż÷½Ï¸ß£¬ÓÈÆä¶ÔÓÚÑÇÖÞÓû§¶øÑÔ£¬ÓÉÓÚ²ÉÓÃÏóÐÎ
ÎÄ×ÖµÄÌØÊâÐÔ£¨°üÀ¨ÖÐÎÄ¡¢º«ÎÄ¡¢ÈÕÎÄ£¬¼ò³ÆΪCJK£©£¬Ê¹µÃ¶ÔLinux½øÐб¾µØ»¯¸üΪÀ§ÄÑ¡£ÔÚÕâÑùµÄ±³¾°Ï£¬ejoyµÈÈË·¢Æð ......
LINUX´ó¶à·¢ÐаæĬÈÏ°²×°¶¼Ã»ÓÐ×°ÏÔ¿¨3DÇý¶¯£¬ÐëÊÖ¹¤°²×°¡£
ATI ÏÔ¿¨µÄLinuxÇý¶¯³£¼ûµÄÓÐÁ½ÖÖ£ºATI catalyst drivers ºÍ open source RadeonHD drivers¡£ATI catalyst driversÊǹٷ½Ö§³ÖµÄ°æ±¾£¬Ö§³Ö´ó¶àÊýATIÏÔ¿¨£¬¿ÉÒÔÔÚ http://support.amd.com/us/gpudownload/Pages/index.aspx Ñ¡Ôñ¶ÔÓ¦µÄ°æ±¾ÏÂÔØ¡£
ÏÂÃæÊÇATI Catal ......
inux±ØѧµÄ60¸öÃüÁî
LinuxÌṩÁË´óÁ¿µÄÃüÁÀûÓÃËü¿ÉÒÔÓÐЧµØÍê³É´óÁ¿µÄ¹¤×÷£¬Èç´ÅÅ̲Ù×÷¡¢Îļþ´æÈ¡¡¢Ä¿Â¼²Ù×÷¡¢½ø³Ì¹ÜÀí¡¢ÎļþȨÏÞÉ趨µÈ¡£ËùÒÔ£¬ÔÚLinuxϵͳÉϹ¤×÷Àë²»¿ªÊ¹ÓÃϵͳÌṩµÄÃüÁî¡£ÒªÏëÕæÕýÀí½âLinuxϵͳ£¬¾Í±ØÐë´ÓLinuxÃüÁîѧÆð£¬Í¨¹ý»ù´¡µÄÃüÁîѧϰ¿ÉÒÔ½øÒ»²½Àí½âLinuxϵͳ¡£
²»Í¬Linux·¢ÐаæµÄÃüÁîÊýÁ¿² ......
Î壺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 ......