Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

LinuxÄÚºËÖÐÄÚ´æcacheµÄʵÏÖ


1. Ç°ÑÔ
kmem_cacheÊÇLinuxÄÚºËÌṩµÄ¿ìËÙÄڴ滺³å½Ó¿Ú£¬ÕâЩÄÚ´æ¿éÒªÇóÊÇ´óСÏàͬµÄ£¬ÒòΪ·ÖÅä³öµÄÄÚ
´æÔÚ½Ó¿ÚÊÍ·Åʱ²¢²»ÕæÕýÊÍ·Å£¬¶øÊÇ×÷Ϊ»º´æ±£Áô£¬ÏÂÒ»´ÎÇëÇó·ÖÅäʱ¾Í¿ÉÒÔÖ±½ÓʹÓã¬Ê¡È¥Á˸÷ÖÖ
ÄÚ´æ¿é³õʼ»¯»òÊͷŵIJÙ×÷£¬Òò´Ë·ÖÅäËٶȺܿ죬ͨ³£ÓÃÓÚ´óÊýÁ¿µÄÄÚ´æ¿é·ÖÅäµÄÇé¿ö£¬Èçinode½Ú
µã£¬skbuffÍ·, netfilterµÄÁ¬½ÓµÈ£¬ÆäʵkmallocÒ²ÊÇ´Ókmem_cacheÖзÖÅäµÄ£¬¿Éͨ
¹ý/proc/slabinfoÎļþÖ±½Ó¶ÁÈ¡cache·ÖÅäÇé¿ö¡£
ÒÔÏÂLinuxÄں˴úÂë°æ±¾Îª2.6.19.2, ³ÌÐòÖ÷Òª³ö×Ômm/slab.cÎļþ, 2.4ºÍ2.6»ù±¾Ô­Àí²î²»¶à,µ«¾ß
ÌåʵÏÖÖÐÓÐÁ˲»Éٱ仯¡£
2. slabºÍpage
ÔÚ½éÉÜkmem_cache֮ǰÐèÒªÏȽéÉÜpageºÍslabÕâÁ½¸ö¶¨Òå¡£ÖÚËùÖÜÖª£¬pageÊÇÄÚºËÖÐÄÚ´æ»ù±¾¹ÜÀíµ¥
λ£¬Ã¿¸öpageµÄÄÚ´æ´óСÊǹ̶¨µÄ£¬¶ÔX86»úÆ÷À´Ëµ£¬ÊÇ4K£»slabÔòÊÇkmem_cacheµÄ¾ßÌåµÄÄÚ´æ¿Õ¼ä
ÐÎʽ£¬¸ù¾ÝcacheµÄ¶ÔÏóµÄ´óС£¬Ã¿¸öslab¿ÉÒÔÓÐ1¸öpageµ½×î¶à32(128/4)¸öpage£»Èç¹ûcache¶ÔÏó±È
Ò»¸öpageµÄ¿Õ¼äС£¬Õâ¸öslabÖлáÈÝÄɶà¸ö¶ÔÏóÒÔ¾¡¿ÉÄܵØÀûÓÿռ䡣
struct slab {
// Á´±í
 struct list_head list;
// δÓÿռäµÄÆ«ÒÆ
 unsigned long colouroff;
// ¾ßÌåµÄÄڴ滺³åÇøµØÖ·
 void *s_mem;  /* including colour offset */
// ÿ¸öslabÖеÄÕýÔÚʹÓõĶÔÏóÊýÁ¿
 unsigned int inuse; /* num of objs active in slab */
// ¿ÕÏжÔÏó
 kmem_bufctl_t free;
 unsigned short nodeid;
};
 
3. Êý¾Ý½á¹¹
kmem_cacheÊý¾Ý½á¹¹²¢Ã»Óж¨ÒåÔÚ.hµÄÍ·ÎļþÖУ¬ÔÚÍ·ÎļþÖÐÖ»ÊǸýṹµÄÒ»¸öÀàÐͶ¨Ò壬ÒòΪÆäËû
µØ·½Ê¹ÓÃkmem_cacheʱÍêÈ«²»ÐèÒªÖªµÀÆäÄÚ²¿½á¹¹£¬¸÷½Ó¿Úº¯ÊýÍêÈ«·â×°½á¹¹ÖеÄÐÅÏ¢£¬ÕâÊÇÓÃCʵ
ÏÖOO±à³ÌµÄ³£Ó÷½Ê½¡£
/* include/linux/slab.h */
// ÕâÀïÖ»ÊÇÒ»¸öÀàÐͶ¨Òå
typedef struct kmem_cache kmem_cache_t;
/* mm/slab.c */
// ÔÚCÎļþÖнøÐÐÍêÕûµÄ¶¨Òå
/*
 * struct array_cache
 *
 * Purpose:
 * - LIFO ordering, to hand out cache-warm objects from _alloc
 * - reduce the number of linked list operations
 * - reduce spinlock operations
 *
 * The limit is stored in the per-cpu structure to reduce the data cache
 * footprint.
 *
 */
// ÕâÊÇÿ¸öCPU¶ÔÓ¦µÄcacheÊý¾Ý
struct array_cache {
 unsign


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

ʵսLinux Bluetooth±à³Ì (Æß) SDPЭÒé

Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖЭÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀЭÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......

01 ʲôÊÇLinux Äñ»ù

POSIX
ÊÇÒ»ÖÖ±ê×¼¹æ·¶£¬Ö÷ÒªÕë¶ÔÔÚ Unix
²Ù×÷ϵͳÉÏÃæÅܵijÌÐòÀ´½øÐй淶¡£ ÈôÄãµÄ²Ù×÷ϵͳ·ûºÏ POSIX £¬Ôò·ûºÏ POSIX µÄ³ÌÐò¾Í¿ÉÒÔÔÚÄãµÄ²Ù×÷ϵͳÉÏÃæÔË×÷¡£ Linux
ÓÉÓÚÖ§³Ö POSIX £¬Òò´ËºÜ¶à Unix ÉϵijÌÐò¿ÉÒÔÖ±½ÓÔÚ Linux ÉÏÔË×÷£¬ Òò´Ë³ÌÐòµÄÒÆÖ²Ï൱¼òÒ×£¡Ò²Èôó¼ÒÈÝÒ×ת»»Æ½Ì¨£¬ÌáÉý
Linux µÄʹÓÃÂÊ¡£
Çý¶¯Óë ......

linux·þÎñ´óÈ«

Òò¹¤×÷ÐèÒª¾­³£Òª²éÕÒÕâЩ·þÎñÓÃ;£¬Òò´Ë½«ÍøÉϵÄһЩÁбí½øÐÐÏàÓ¦ÊÕ¼¯ÕûÀí£¬·½±ã²éÔÄ
²»Òª¹Ø±ÕÒÔÏ·þÎñ£¨³ý·ÇÄãÓгä×ãµÄÀíÓÉ£©£º
acpid, haldaemon, messagebus, klogd, network, syslogd
ÇëÈ·¶¨Ð޸ĵÄÊÇÔËÐ춱ð 3 ºÍ 5¡£
NetworkManager, NetworkManagerDispatcher
       &nbs ......

LinuxÏÂgdbµ÷ÊÔ³ÌÐòµÄ³£ÓÃÃüÁî


ÔÚLinuxµÄc±à³ÌÖдó¼Ò¾­³£ÓÃgdbµ÷ÊÔ³ÌÐò£¬ÒÔÏÂÊÇһЩ³£ÓõÄÖ¸Áî 1.break FUNCTION ÔÚij¸öº¯ÊýÉÏÉèÖöϵ㡣º¯ÊýÖØÔØʱ£¬ÓпÉÄÜͬʱÔÚ¼¸¸öÖØÔصĺ¯ÊýÉÏÉèÖÃÁ˶ϵã
break +OFFSET break -OFFSET ÔÚµ±Ç°³ÌÐòÔËÐе½µÄÇ°¼¸Ðлòºó¼¸ÐÐÉèÖöϵã
break LINENUM ÔÚÐкÅΪLINENUMµÄÐÐÉÏÉèÖöϵã
break FILENAME:LINENUM ÔÚÎļþÃûÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ