欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 产业 > 统计内存外碎片事件

统计内存外碎片事件

2024/11/30 10:37:23 来源:https://blog.csdn.net/pengdonglin137/article/details/140867862  浏览:    关键词:统计内存外碎片事件

参考

  • https://blog.csdn.net/qq_43573047/article/details/140734352
  • https://zhuanlan.zhihu.com/p/479922331

在内存分配的时候,当指定的迁移类型的内存不足时,会向其他迁移类型借,内核通过下面的数组定义了迁移类型的借用顺序:

/** This array describes the order lists are fallen back to when* the free lists for the desirable migrate type are depleted** The other migratetypes do not have fallbacks.*/
static int fallbacks[MIGRATE_TYPES][3] = {[MIGRATE_UNMOVABLE]   = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE,   MIGRATE_TYPES },[MIGRATE_MOVABLE]     = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_TYPES },[MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE,   MIGRATE_MOVABLE,   MIGRATE_TYPES },
};

这部分的代码如下:

/** Try finding a free buddy page on the fallback list and put it on the free* list of requested migratetype, possibly along with other pages from the same* block, depending on fragmentation avoidance heuristics. Returns true if* fallback was found so that __rmqueue_smallest() can grab it.** The use of signed ints for order and current_order is a deliberate* deviation from the rest of this file, to make the for loop* condition simpler.*/
static __always_inline bool
__rmqueue_fallback(struct zone *zone, int order, int start_migratetype,unsigned int alloc_flags)
{struct 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com