/#ifdefCONFIG_MEMORY_HOTREMOVEstaticunsignedlong*__initsparse_early_usemaps_alloc_pgdat_section(structpglist_data*pgdat,unsignedlongsize){unsignedlonggoal,limit;unsignedlong*p;intnid;/** A page may contain usemaps for other sections preventing the* page being freed and making a section unremovable ...
sparse_buffer_init(map_count * section_map_size(), nid): 该函数提前将一个节点内的物理内存管理结构mem_map申请好,后续每个mem_section的mem_map直接从sparsemap_buf中进行划分。: static void __init sparse_buffer_init(unsigned long size, int nid) { phys_addr_t addr = __pa(MAX_DMA_ADDRESS);...
sparse_init_nid()用于初始化一个node节点上的mem_section,完成初始化。sparse_init_one_section初始化一个section,设置section_mem_map、usage并调整状态。调用关系基于X86 64平台,主要涉及的调用关系见下。paging_init()根据不同架构具体实现,逻辑相同。
sparse_index_init(section, nid):初始化sparse mem_section如果开启CONFIG_SPARSEMEM_EXTREME 则需要 申请 mem_section (为mem_section 对象分配内存 ), 如果非开启则什么都不处理 set_section_nid(): 只有NODE_NOT_IN_PAGE_FLAGS开启才有效,section_to_node_table[section_nr] 主要存储这nr与node id对应管理表...
There are two code path which invoke __populate_section_memmap() * sparse_init_nid() * sparse_add_section() For both case, we are sure the memory range is sub-section aligned. * we pass PAGES_PER_SECTION to sparse_init_nid() * we check range by check_pfn_span() before calling sp...
sparse_init -> memblocks_present -> memory_present 252staticvoid__init memory_present(intnid, unsignedlongstart, unsignedlongend)253{254unsignedlongpfn;255256#ifdef CONFIG_SPARSEMEM_EXTREME257if(unlikely(!mem_section)) {258unsignedlongsize, align;259260size =sizeof(structmem_section*) *NR_SECTION...
panic("%s: Failed to allocate %lu bytes nid=%d\n", __func__, array_size, nid); } return section; } static int __meminit sparse_index_init(unsigned long section_nr, int nid) { unsigned long root = SECTION_NR_TO_ROOT(section_nr); struct mem_section *section; /...
section = sparse_index_alloc(nid); if (!section) return -ENOMEM;mem_section[root] = section;return 0; } #else /* !SPARSEMEM_EXTREME */ static inline int sparse_index_init(unsigned long section_nr, int nid) { return 0; } #endif...
File "test.py", line 12, in <module> model = whisper.load_model("turbo") File "/data/jiacheng/pyProjects/speech-to-text/whisper/__init__.py", line 160, in load_model return model.to(device) File "/usr/local/python3.8/lib/python3.8/site-packages/torch_npu/contrib/transfer_to_npu...
SPARSEMEM模型的初始化主要由sparse_init()函数完成,上面的mem_section初始化也是sparse_init()函数的一部分 void__initsparse_init(void){unsignedlongpnum_end,pnum_begin,map_count=1;intnid_begin;memblocks_present();pnum_begin=first_present_section_nr();nid_begin=sparse_early_nid(__nr_to_section(pn...