博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
__alloc_pages
阅读量:4559 次
发布时间:2019-06-08

本文共 3748 字,大约阅读时间需要 12 分钟。

2470 /*2471  * This is the 'heart' of the zoned buddy allocator.2472  */ /* 参数理解: */ /* GFP = Get Free Pages ? */ /* 098 typedef struct { (, ); } ; */ /* #define DECLARE_BITMAP(name,bits) \     unsigned long name[BITS_TO_LONGS(bits)] */ /* typedef struct {
unsigned long bits[ BITS_TO_LONGS( ) ]; } nodemask_t */ /* #define () (, * sizeof(long)) */ /* #define 8 */ /* #define (,) ((() + () - 1) / ()) */ /* d表示一个数据类型有多少bit, n表示要存储多少位, 现在计算要多少个这样的数据类型 */ /* order 表示 2^order 个页 */ / zonelist 表示zone的链表 */2473 struct *2474 ( , unsigned int ,2475 struct *, *)2476 {2477 enum = (); /*
0247 static inline enum  ( )0248 {0249         enum  ;0250         int  = ( int) ( & ); /* 过滤这些标志位吗 ? */0251 0252          = ( >> ( * )) &0253                                          ((1 << ) - 1);0254         (( >> ) & 1);0255         return ;0256 } */
/* 0219 #define  ( \0220         ( << 0 * )                                      \0221         | ( <<  * )                          \0222         | ( <<  * )                  \0223         | ( <<  * )                      \0224         | ( <<  * )                       \0225         | ( << ( | ) * )       \0226         | ( << ( | ) * )   \0227         | ( << ( | ) * )   \0228 ) */ /* #define  (|||) */ /*
0319 #if  < 20320 #define  00321 #elif  <= 20322 #define  10323 #elif  <= 40324 #define  2 */ /* 这么多就是要获取zone的下标 */ 2478         struct  *;2479         struct  * = ; /* Convert GFP flags to their corresponding migrate type */2480         int  = ();2481         unsigned int ;2482
0373 /*0374  * gfp_allowed_mask is set to GFP_BOOT_MASK during early boot to restrict what0375  * GFP flags are used before interrupts are enabled. Once interrupts are0376  * enabled, it is set to __GFP_BITS_MASK while the system is running. During0377  * hibernation, it is used by PM to avoid I/O during memory allocation while0378  * devices are suspended.0379  */
2483          &= ;2484 2485         ();2486 /* 0169 #define () do { if () (); } while (0) */2487         ( & );2488 2489         if ((, ))2490                 return ;2491 2492         /*2493          * Check the zones suitable for the gfp_mask contain at least one2494          * valid zone. It's possible to have an empty zonelist as a result2495          * of GFP_THISNODE and a memoryless node2496          */2497         if ((!->->))2498                 return ;2499 2500 retry_cpuset:2501          = ();2502 2503         /* The preferred zone is used for statistics later */2504         (, ,2505                                  ? : &,2506                                 &);2507         if (!)2508                 goto ;2509 /* 1779  * get_page_from_freelist goes through the zonelist trying to allocate1780  * a page.1781  */ 1782 static struct  *1783 ( ,  *, unsigned int ,1784                 struct  *, int , int ,1785                 struct  *, int ){ ... } */ 2510         /* First allocation attempt */2511          = (|, , ,2512                         , , |,2513                         , );2514         if ((!)) /* 很少失败 */2515                  = (, ,2516                                 , , ,2517                                 , );2518 2519         trace_mm_page_alloc(, , , );2520 2521 :2522         /*2523          * When updating a task's mems_allowed, it is possible to race with2524          * parallel threads in such a way that an allocation can fail while2525          * the mask is being updated. If a page allocation is about to fail,2526          * check if the cpuset changed during allocation and if so, retry.2527          */2528         if ((!() && !))2529                 goto retry_cpuset;2530 2531         return ;2532 }

转载于:https://www.cnblogs.com/kwingmei/p/3277296.html

你可能感兴趣的文章
SystemTap 静态探针安装包
查看>>
redis五种数据类型的使用
查看>>
浏览器全屏之requestFullScreen全屏与F11全屏
查看>>
软件包管理:rpm命令管理-安装升级与卸载
查看>>
旋转图像
查看>>
字符串中的数字(字符串、循环)
查看>>
15.select into
查看>>
运行web项目端口占用问题
查看>>
Java Spring-IOC和DI
查看>>
【NOIP1999】【Luogu1015】回文数(高精度,模拟)
查看>>
Linux上安装Python3.5
查看>>
crt安装
查看>>
git切换分支报错:error: pathspec 'origin/XXX' did not match any file(s) known to git
查看>>
c++中static的用法详解
查看>>
转 我修改的注册表,但是程序运行起来,还是记着以前的
查看>>
图片轮播功能
查看>>
第六周小组作业:软件测试和评估
查看>>
debian(kali Linux) 安装net Core
查看>>
centos 7防火墙设置
查看>>
每日一小练——数值自乘递归解
查看>>