本文整理汇总了C++中NODE_DATA函数的典型用法代码示例。如果您正苦于以下问题:C++ NODE_DATA函数的具体用法?C++ NODE_DATA怎么用?C++ NODE_DATA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NODE_DATA函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: NODE_DATA
struct page *lookup_cgroup_page(struct page_cgroup *pc)
{
unsigned long pfn;
struct page *page;
pg_data_t *pgdat;
pgdat = NODE_DATA(page_cgroup_array_id(pc));
pfn = pc - pgdat->node_page_cgroup + pgdat->node_start_pfn;
page = pfn_to_page(pfn);
VM_BUG_ON(pc != lookup_page_cgroup(page));
return page;
}
开发者ID:285452612,项目名称:ali_kernel,代码行数:12,代码来源:page_cgroup.c
示例2: alloc_node_page_cgroup
static int __init alloc_node_page_cgroup(int nid)
{
struct page_cgroup *base;
unsigned long table_size;
unsigned long nr_pages;
nr_pages = NODE_DATA(nid)->node_spanned_pages;
if (!nr_pages)
return 0;
table_size = sizeof(struct page_cgroup) * nr_pages;
base = memblock_virt_alloc_try_nid_nopanic(
table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS),
BOOTMEM_ALLOC_ACCESSIBLE, nid);
if (!base)
return -ENOMEM;
NODE_DATA(nid)->node_page_cgroup = base;
total_usage += table_size;
return 0;
}
开发者ID:ExtremeGTX,项目名称:Devkit8500_Linux_BSP,代码行数:21,代码来源:page_cgroup.c
示例3: alloc_node_page_cgroup
static int __init alloc_node_page_cgroup(int nid)
{
struct page_cgroup *base;
unsigned long table_size;
unsigned long nr_pages;
nr_pages = NODE_DATA(nid)->node_spanned_pages;
if (!nr_pages)
return 0;
table_size = sizeof(struct page_cgroup) * nr_pages;
base = __alloc_bootmem_node_nopanic(NODE_DATA(nid),
table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
if (!base)
return -ENOMEM;
NODE_DATA(nid)->node_page_cgroup = base;
total_usage += table_size;
page_cgroup_lock_init(base, nr_pages);
return 0;
}
开发者ID:stoku,项目名称:linux-3.6.11-ab,代码行数:21,代码来源:page_cgroup.c
示例4: bootmem_init_one_node
static void __init bootmem_init_one_node(unsigned int nid)
{
unsigned long total_pages, paddr;
unsigned long end_pfn;
struct pglist_data *p;
p = NODE_DATA(nid);
/* Nothing to do.. */
if (!p->node_spanned_pages)
return;
end_pfn = p->node_start_pfn + p->node_spanned_pages;
#ifdef CONFIG_HIGHMEM
if (end_pfn > max_low_pfn)
end_pfn = max_low_pfn;
#endif
total_pages = bootmem_bootmap_pages(end_pfn - p->node_start_pfn);
paddr = memblock_alloc(total_pages << PAGE_SHIFT, PAGE_SIZE);
if (!paddr)
panic("Can't allocate bootmap for nid[%d]\n", nid);
init_bootmem_node(p, paddr >> PAGE_SHIFT, p->node_start_pfn, end_pfn);
free_bootmem_with_active_regions(nid, end_pfn);
/*
* XXX Handle initial reservations for the system memory node
* only for the moment, we'll refactor this later for handling
* reservations in other nodes.
*/
if (nid == 0) {
struct memblock_region *reg;
/* Reserve the sections we're already using. */
for_each_memblock(reserved, reg) {
unsigned long size = reg->size;
#ifdef CONFIG_HIGHMEM
/* ...but not highmem */
if (PFN_DOWN(reg->base) >= highstart_pfn)
continue;
if (PFN_UP(reg->base + size) > highstart_pfn)
size = (highstart_pfn - PFN_DOWN(reg->base))
<< PAGE_SHIFT;
#endif
reserve_bootmem(reg->base, size, BOOTMEM_DEFAULT);
}
}
开发者ID:1n00bB,项目名称:android_kernel_lenovo_a6010,代码行数:53,代码来源:init.c
示例5: mem_init
void __init mem_init(void)
{
int codesize, datasize, initsize;
int nid;
num_physpages = 0;
high_memory = NULL;
for_each_online_node(nid) {
pg_data_t *pgdat = NODE_DATA(nid);
unsigned long node_pages = 0;
void *node_high_memory;
num_physpages += pgdat->node_present_pages;
if (pgdat->node_spanned_pages)
node_pages = free_all_bootmem_node(pgdat);
totalram_pages += node_pages;
node_high_memory = (void *)__va((pgdat->node_start_pfn +
pgdat->node_spanned_pages) <<
PAGE_SHIFT);
if (node_high_memory > high_memory)
high_memory = node_high_memory;
}
/* clear the zero-page */
memset(empty_zero_page, 0, PAGE_SIZE);
__flush_wback_region(empty_zero_page, PAGE_SIZE);
codesize = (unsigned long) &_etext - (unsigned long) &_text;
datasize = (unsigned long) &_edata - (unsigned long) &_etext;
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
VMALLOC_END - VMALLOC_START);
printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
"%dk data, %dk init)\n",
(unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
num_physpages << (PAGE_SHIFT-10),
codesize >> 10,
datasize >> 10,
initsize >> 10);
p3_cache_init();
/* Initialize the vDSO */
vsyscall_init();
}
开发者ID:AppEngine,项目名称:linux-2.6,代码行数:52,代码来源:init.c
示例6: prio_sched_for_all_threads
void prio_sched_for_all_threads(struct sched_t* sched, void(*func)(thread_t*))
{
int i;
for (i = 0; i < LOWEST_PRIO; ++i)
{
node_t* node = QUEUE_HEAD(SCHED_QUEUE(sched)[i]);
while (node != NULL)
{
func(NODE_DATA(node));
node = NODE_NEXT(node);
}
}
}
开发者ID:FreifeldRoyi,项目名称:user-level-threads,代码行数:13,代码来源:prio_scheduler.c
示例7: arm_bootmem_init
// ARM10C 20131207
// min: 0x20000, max_low: 0x4f800
static void __init arm_bootmem_init(unsigned long start_pfn,
unsigned long end_pfn)
{
struct memblock_region *reg;
unsigned int boot_pages;
phys_addr_t bitmap;
pg_data_t *pgdat;
/*
* Allocate the bootmem bitmap page. This must be in a region
* of memory which has already been mapped.
*/
// start_pfn: 0x20000, end_pfn: 0x4f800, end_pfn - start_pfn: 0x2f800
// boot_pages: 0x6
boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
// boot_pages << PAGE_SHIFT: 0x6000, L1_CACHE_BYTES: 64
// __pfn_to_phys(0x4f800); 0x4f800000
bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
__pfn_to_phys(end_pfn));
/*
* Initialise the bootmem allocator, handing the
* memory banks over to bootmem.
*/
node_set_online(0);
// pglist_data.bdata 의 bootmem_node_data 주소로 설정
pgdat = NODE_DATA(0);
// pgdat: ?, __phys_to_pfn(bitmap): ?, start_pfn: 0x20000, end_pfn: 0x4f800
init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
/* Free the lowmem regions from memblock into bootmem. */
for_each_memblock(memory, reg) {
// start: 0x20000
unsigned long start = memblock_region_memory_base_pfn(reg);
// end: 0xA0000
unsigned long end = memblock_region_memory_end_pfn(reg);
// end: 0xA0000, end_pfn: 0x4f800
if (end >= end_pfn)
// end: 0x4f800
end = end_pfn;
// start: 0x20000, end: 0x4f800
if (start >= end)
break;
// __pfn_to_phys(0x20000): 0x20000000, (end - start) << PAGE_SHIFT: 0x2f800000
free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
}
开发者ID:phanirajkiran,项目名称:iamroot-linux-arm10c,代码行数:53,代码来源:init.c
示例8: paging_init
/*
* paging_init() sets up the page tables
*/
void __init paging_init(void)
{
unsigned long max_zone_pfns[MAX_NR_ZONES];
int nid;
/* We don't need to map the kernel through the TLB, as
* it is permanatly mapped using P1. So clear the
* entire pgd. */
memset(swapper_pg_dir, 0, sizeof(swapper_pg_dir));
/* Set an initial value for the MMU.TTB so we don't have to
* check for a null value. */
set_TTB(swapper_pg_dir);
/* Populate the relevant portions of swapper_pg_dir so that
* we can use the fixmap entries without calling kmalloc.
* pte's will be filled in by __set_fixmap(). */
page_table_range_init(FIXADDR_START, FIXADDR_TOP, swapper_pg_dir);
memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
for_each_online_node(nid) {
pg_data_t *pgdat = NODE_DATA(nid);
unsigned long low, start_pfn;
start_pfn = pgdat->bdata->node_min_pfn;
low = pgdat->bdata->node_low_pfn;
if (max_zone_pfns[ZONE_NORMAL] < low)
max_zone_pfns[ZONE_NORMAL] = low;
printk("Node %u: start_pfn = 0x%lx, low = 0x%lx\n",
nid, start_pfn, low);
}
free_area_init_nodes(max_zone_pfns);
#ifdef CONFIG_SUPERH32
/* Set up the uncached fixmap */
set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start));
#ifdef CONFIG_29BIT
/*
* Handle trivial transitions between cached and uncached
* segments, making use of the 1:1 mapping relationship in
* 512MB lowmem.
*/
cached_to_uncached = P2SEG - P1SEG;
#endif
#endif
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:54,代码来源:init.c
示例9: setup_memory
unsigned long __init setup_memory(void)
{
unsigned long bootmap_size;
unsigned long min_pfn;
int nid;
mem_prof_t *mp;
max_low_pfn = 0;
min_low_pfn = -1;
mem_prof_init();
for_each_online_node(nid) {
mp = &mem_prof[nid];
NODE_DATA(nid)=(pg_data_t *)&m32r_node_data[nid];
NODE_DATA(nid)->bdata = &node_bdata[nid];
min_pfn = mp->start_pfn;
max_pfn = mp->start_pfn + mp->pages;
bootmap_size = init_bootmem_node(NODE_DATA(nid), mp->free_pfn,
mp->start_pfn, max_pfn);
free_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn),
PFN_PHYS(mp->pages));
reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn),
PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size);
if (max_low_pfn < max_pfn)
max_low_pfn = max_pfn;
if (min_low_pfn > min_pfn)
min_low_pfn = min_pfn;
}
#ifdef CONFIG_BLK_DEV_INITRD
if (LOADER_TYPE && INITRD_START) {
if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) {
reserve_bootmem_node(NODE_DATA(0), INITRD_START,
INITRD_SIZE);
initrd_start = INITRD_START ?
INITRD_START + PAGE_OFFSET : 0;
initrd_end = initrd_start + INITRD_SIZE;
printk("initrd:start[%08lx],size[%08lx]\n",
initrd_start, INITRD_SIZE);
} else {
printk("initrd extends beyond end of memory "
"(0x%08lx > 0x%08lx)\ndisabling initrd\n",
INITRD_START + INITRD_SIZE,
PFN_PHYS(max_low_pfn));
initrd_start = 0;
}
}
#endif /* CONFIG_BLK_DEV_INITRD */
return max_low_pfn;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:58,代码来源:discontig.c
示例10: _list_menu
void _list_menu(QSP_ARG_DECL const Menu *mp)
{
List *lp;
Node *np;
lp = MENU_LIST(mp);
np = QLIST_HEAD(lp);
while( np != NULL ){
Command *cp;
cp = (Command *) NODE_DATA(np);
list_command(QSP_ARG cp);
np = NODE_NEXT(np);
}
}
开发者ID:jbmulligan,项目名称:quip,代码行数:14,代码来源:menu.c
示例11: next_online_node
// ARM10C 20140329
// pgdat: &contig_page_data
struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
{
// pgdat->node_id: (&contig_page_data)->node_id: 0
// next_online_node((&contig_page_data)->node_id): 1
int nid = next_online_node(pgdat->node_id);
// nid: 1
// MAX_NUMNODES: 1
if (nid == MAX_NUMNODES)
return NULL;
// return NULL
return NODE_DATA(nid);
}
开发者ID:arm10c,项目名称:linux-stable,代码行数:16,代码来源:mmzone.c
示例12: _call_funcs_from_list
void _call_funcs_from_list(QSP_ARG_DECL List *lp )
{
Node *np;
void (*func)(SINGLE_QSP_ARG_DECL);
np=QLIST_HEAD(lp);
assert( np != NULL );
while( np != NULL ){
func = (void (*)(SINGLE_QSP_ARG_DECL)) NODE_DATA(np);
(*func)(SINGLE_QSP_ARG);
np = NODE_NEXT(np);
}
}
开发者ID:jbmulligan,项目名称:quip,代码行数:14,代码来源:callback.c
示例13: alloc_node_page_cgroup
static int __init alloc_node_page_cgroup(int nid)
{
struct page_cgroup *base, *pc;
unsigned long table_size;
unsigned long start_pfn, nr_pages, index;
start_pfn = NODE_DATA(nid)->node_start_pfn;
nr_pages = NODE_DATA(nid)->node_spanned_pages;
table_size = sizeof(struct page_cgroup) * nr_pages;
base = __alloc_bootmem_node_nopanic(NODE_DATA(nid),
table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
if (!base)
return -ENOMEM;
for (index = 0; index < nr_pages; index++) {
pc = base + index;
__init_page_cgroup(pc, start_pfn + index);
}
NODE_DATA(nid)->node_page_cgroup = base;
total_usage += table_size;
return 0;
}
开发者ID:masbog,项目名称:iphonelinux-kernel,代码行数:23,代码来源:page_cgroup.c
示例14: init_section_page_cgroup
/* __alloc_bootmem...() is protected by !slab_available() */
int __init_refok init_section_page_cgroup(unsigned long pfn)
{
struct mem_section *section;
struct page_cgroup *base, *pc;
unsigned long table_size;
int nid, index;
section = __pfn_to_section(pfn);
if (!section->page_cgroup) {
nid = page_to_nid(pfn_to_page(pfn));
table_size = sizeof(struct page_cgroup) * PAGES_PER_SECTION;
if (slab_is_available()) {
base = kmalloc_node(table_size, GFP_KERNEL, nid);
if (!base)
base = vmalloc_node(table_size, nid);
} else {
base = __alloc_bootmem_node_nopanic(NODE_DATA(nid),
table_size,
PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
}
} else {
/*
* We don't have to allocate page_cgroup again, but
* address of memmap may be changed. So, we have to initialize
* again.
*/
base = section->page_cgroup + pfn;
table_size = 0;
/* check address of memmap is changed or not. */
if (base->page == pfn_to_page(pfn))
return 0;
}
if (!base) {
printk(KERN_ERR "page cgroup allocation failure\n");
return -ENOMEM;
}
for (index = 0; index < PAGES_PER_SECTION; index++) {
pc = base + index;
__init_page_cgroup(pc, pfn + index);
}
section = __pfn_to_section(pfn);
section->page_cgroup = base - pfn;
total_usage += table_size;
return 0;
}
开发者ID:masbog,项目名称:iphonelinux-kernel,代码行数:50,代码来源:page_cgroup.c
示例15: setup_bootmem_node
void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
{
unsigned long bootmap_pages, bootmap_start, bootmap_size;
unsigned long start_pfn, free_pfn, end_pfn;
/* Don't allow bogus node assignment */
BUG_ON(nid > MAX_NUMNODES || nid == 0);
/*
* The free pfn starts at the beginning of the range, and is
* advanced as necessary for pgdat and node map allocations.
*/
free_pfn = start_pfn = start >> PAGE_SHIFT;
end_pfn = end >> PAGE_SHIFT;
__add_active_range(nid, start_pfn, end_pfn);
/* Node-local pgdat */
NODE_DATA(nid) = pfn_to_kaddr(free_pfn);
free_pfn += PFN_UP(sizeof(struct pglist_data));
memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
NODE_DATA(nid)->node_start_pfn = start_pfn;
NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
/* Node-local bootmap */
bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
bootmap_start = (unsigned long)pfn_to_kaddr(free_pfn);
bootmap_size = init_bootmem_node(NODE_DATA(nid), free_pfn, start_pfn,
end_pfn);
free_bootmem_with_active_regions(nid, end_pfn);
/* Reserve the pgdat and bootmap space with the bootmem allocator */
reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT,
sizeof(struct pglist_data), BOOTMEM_DEFAULT);
reserve_bootmem_node(NODE_DATA(nid), free_pfn << PAGE_SHIFT,
bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
/* It's up */
node_set_online(nid);
/* Kick sparsemem */
sparse_memory_present_with_active_regions(nid);
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:46,代码来源:numa.c
示例16: alloc_node_page_ext
static int __init alloc_node_page_ext(int nid)
{
struct page_ext *base;
unsigned long table_size;
unsigned long nr_pages;
/* IAMROOT-12AB:
* -------------
* page_ext 구조체용 메모리를 페이지 수 만큼 할당한다.
* (정렬되어 있지 않은 경우 MAX_ORDER_NR_PAGES(2^(MAX_ORDER-1))만큼 추가 할당한다)
* 노드 구조체의 node_page_ext는 이 page_ext를 가리킨다.
*/
nr_pages = NODE_DATA(nid)->node_spanned_pages;
if (!nr_pages)
return 0;
/*
* Need extra space if node range is not aligned with
* MAX_ORDER_NR_PAGES. When page allocator's buddy algorithm
* checks buddy's status, range could be out of exact node range.
*/
if (!IS_ALIGNED(node_start_pfn(nid), MAX_ORDER_NR_PAGES) ||
!IS_ALIGNED(node_end_pfn(nid), MAX_ORDER_NR_PAGES))
nr_pages += MAX_ORDER_NR_PAGES;
table_size = sizeof(struct page_ext) * nr_pages;
base = memblock_virt_alloc_try_nid_nopanic(
table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS),
BOOTMEM_ALLOC_ACCESSIBLE, nid);
if (!base)
return -ENOMEM;
NODE_DATA(nid)->node_page_ext = base;
total_usage += table_size;
return 0;
}
开发者ID:iamroot12a,项目名称:kernel,代码行数:36,代码来源:page_ext.c
示例17: link_mem_sections
static int link_mem_sections(int nid)
{
unsigned long start_pfn = NODE_DATA(nid)->node_start_pfn;
unsigned long end_pfn = start_pfn + NODE_DATA(nid)->node_spanned_pages;
unsigned long pfn;
struct memory_block *mem_blk = NULL;
int err = 0;
for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
unsigned long section_nr = pfn_to_section_nr(pfn);
struct mem_section *mem_sect;
int ret;
if (!present_section_nr(section_nr))
continue;
mem_sect = __nr_to_section(section_nr);
/* same memblock ? */
if (mem_blk)
if ((section_nr >= mem_blk->start_section_nr) &&
(section_nr <= mem_blk->end_section_nr))
continue;
mem_blk = find_memory_block_hinted(mem_sect, mem_blk);
ret = register_mem_sect_under_node(mem_blk, nid);
if (!err)
err = ret;
/* discard ref obtained in find_memory_block() */
}
if (mem_blk)
kobject_put(&mem_blk->dev.kobj);
return err;
}
开发者ID:01org,项目名称:thunderbolt-software-kernel-tree,代码行数:36,代码来源:node.c
示例18: arch_add_memory
int arch_add_memory(int nid, u64 start, u64 size)
{
pg_data_t *pgdat;
unsigned long start_pfn = start >> PAGE_SHIFT;
unsigned long nr_pages = size >> PAGE_SHIFT;
int ret;
pgdat = NODE_DATA(nid);
/* We only have ZONE_NORMAL, so this is easy.. */
ret = __add_pages(pgdat->node_zones + ZONE_NORMAL, start_pfn, nr_pages);
if (unlikely(ret))
printk("%s: Failed, __add_pages() == %d\n", __func__, ret);
return ret;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:16,代码来源:init.c
示例19: sizeof
static struct mem_section *sparse_index_alloc(int nid)
{
struct mem_section *section = NULL;
unsigned long array_size = SECTIONS_PER_ROOT *
sizeof(struct mem_section);
if (slab_is_available())
section = kmalloc_node(array_size, GFP_KERNEL, nid);
else
section = alloc_bootmem_node(NODE_DATA(nid), array_size);
if (section)
memset(section, 0, array_size);
return section;
}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:16,代码来源:sparse.c
示例20: arch_add_memory
int arch_add_memory(int nid, u64 start, u64 size)
{
struct pglist_data *pgdat;
struct zone *zone;
int rc;
pgdat = NODE_DATA(nid);
zone = pgdat->node_zones + ZONE_MOVABLE;
rc = vmem_add_mapping(start, size);
if (rc)
return rc;
rc = __add_pages(nid, zone, PFN_DOWN(start), PFN_DOWN(size));
if (rc)
vmem_remove_mapping(start, size);
return rc;
}
开发者ID:1703011,项目名称:asuswrt-merlin,代码行数:16,代码来源:init.c
注:本文中的NODE_DATA函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论