• init_bootmem_node


    初始化pg_data_t->bdtat结构体,

    /*
     * node_bootmem_map is a map pointer - the bits represent all physical 
     * memory pages (including holes) on the node.
     */
    typedef struct bootmem_data {
        unsigned long node_min_pfn;
        unsigned long node_low_pfn;
        void *node_bootmem_map;
        unsigned long last_end_off;
        unsigned long hint_idx;
        struct list_head list;
    } bootmem_data_t;

    将不同node的bdata添加到以bdata_list为首的链表。

    标记所有的bitmap位为1。

    unsigned long __init init_bootmem_node(pg_data_t *pgdat, unsigned long freepfn,    unsigned long startpfn, unsigned long endpfn)
        -->init_bootmem_core(pgdat->bdata, freepfn, startpfn, endpfn);
            -->link_bootmem(bdata);
            /*标记所有内存页框为1,已使用*/
            -->mapsize = bootmap_bytes(end - start);
            -->memset(bdata->node_bootmem_map, 0xff, mapsize);
    /*
     * Called once to set up the allocator itself.
     */
    static unsigned long __init init_bootmem_core(bootmem_data_t *bdata,
        unsigned long mapstart, unsigned long start, unsigned long end)
    {
        unsigned long mapsize;
    
        mminit_validate_memmodel_limits(&start, &end);
        bdata->node_bootmem_map = phys_to_virt(PFN_PHYS(mapstart));
        bdata->node_min_pfn = start;
        bdata->node_low_pfn = end;
        link_bootmem(bdata);
    
        /*
         * Initially all pages are reserved - setup_arch() has to
         * register free RAM areas explicitly.
         */
        mapsize = bootmap_bytes(end - start);
        memset(bdata->node_bootmem_map, 0xff, mapsize);
    
        bdebug("nid=%td start=%lx map=%lx end=%lx mapsize=%lx
    ",
            bdata - bootmem_node_data, start, mapstart, end, mapsize);
    
        return mapsize;
    }
    init_bootmem_core
  • 相关阅读:
    Codeforces Round #595 (Div. 3) A,B,C,D
    计算几何板子题【2019牛客国庆集训派对day7——三角形和矩形】【多边形相交的面积】
    [POJ]POJ1753(dfs)
    [POJ]POJ2965(dfs)
    洛谷 P1772 [ZJOI2006]物流运输 题解
    简单概率与期望
    洛谷 P3802 小魔女帕琪 题解
    用树状数组实现的平衡树
    【模板】扩展中国剩余定理(EXCRT)
    新博客开通通知
  • 原文地址:https://www.cnblogs.com/yangjiguang/p/9464921.html
Copyright © 2020-2023  润新知