linux kernel struct 之 kmem_cache_cpu

linux-4.9.37/include/linux/slub_def.h

高速缓存分配器的一个核心结构体。它用于保存特定CPU缓存行相关的数据,比如空闲对象列表等。


enum stat_item {
    ALLOC_FASTPATH,        /* Allocation from cpu slab */
    ALLOC_SLOWPATH,        /* Allocation by getting a new cpu slab */
    FREE_FASTPATH,        /* Free to cpu slab */
    FREE_SLOWPATH,        /* Freeing not to cpu slab */
    FREE_FROZEN,        /* Freeing to frozen slab */
    FREE_ADD_PARTIAL,    /* Freeing moves slab to partial list */
    FREE_REMOVE_PARTIAL,    /* Freeing removes last object */
    ALLOC_FROM_PARTIAL,    /* Cpu slab acquired from node partial list */
    ALLOC_SLAB,        /* Cpu slab acquired from page allocator */
    ALLOC_REFILL,        /* Refill cpu slab from slab freelist */
    ALLOC_NODE_MISMATCH,    /* Switching cpu slab */
    FREE_SLAB,        /* Slab freed to the page allocator */
    CPUSLAB_FLUSH,        /* Abandoning of the cpu slab */
    DEACTIVATE_FULL,    /* Cpu slab was full when deactivated */
    DEACTIVATE_EMPTY,    /* Cpu slab was empty when deactivated */
    DEACTIVATE_TO_HEAD,    /* Cpu slab was moved to the head of partials */
    DEACTIVATE_TO_TAIL,    /* Cpu slab was moved to the tail of partials */
    DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */
    DEACTIVATE_BYPASS,    /* Implicit deactivation */
    ORDER_FALLBACK,        /* Number of times fallback was necessary */
    CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */
    CMPXCHG_DOUBLE_FAIL,    /* Number of times that cmpxchg double did not match */
    CPU_PARTIAL_ALLOC,    /* Used cpu partial on alloc */
    CPU_PARTIAL_FREE,    /* Refill cpu partial on free */
    CPU_PARTIAL_NODE,    /* Refill cpu partial from node partial */
    CPU_PARTIAL_DRAIN,    /* Drain cpu partial to node partial */
    NR_SLUB_STAT_ITEMS };

struct kmem_cache_cpu {
    void **freelist;    /* Pointer to next available object */
    unsigned long tid;    /* Globally unique transaction id */
    struct page *page;    /* The slab from which we are allocating */
    struct page *partial;    /* Partially allocated frozen slabs */
#ifdef CONFIG_SLUB_STATS
    unsigned stat[NR_SLUB_STAT_ITEMS];
#endif
};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值