devicemodel/core/hugetlb.c
/* try to reserve more huge pages on the level */
try to reserve more huge pages on the level
try to reserve more huge pages on the level
static void reserve_more_pages(int level)
{
	int total_pages, orig_pages, cur_pages;
	char cmd_buf[MAX_PATH_LEN];
	FILE *fp;
	orig_pages = read_sys_info(hugetlb_priv[level].nr_pages_path);
	total_pages = orig_pages + hugetlb_priv[level].pages_delta;
	snprintf(cmd_buf, MAX_PATH_LEN, "echo %d > %s",
		total_pages, hugetlb_priv[level].nr_pages_path);
	fp = popen(cmd_buf, "r");
	if (fp == NULL) {
		pr_err("cmd: %s failed!\n", cmd_buf);
		return;
	}
	pclose(fp);
	pr_info("to reserve pages (+orig %d): %s\n", orig_pages, cmd_buf);
	cur_pages = read_sys_info(hugetlb_priv[level].nr_pages_path);
	hugetlb_priv[level].pages_delta = total_pages - cur_pages;
}
static void reserve_more_pages ( int level ) { int total_pages , orig_pages , cur_pages ; char cmd_buf [ MAX_PATH_LEN ] ; FILE * fp ; orig_pages = read_sys_info ( hugetlb_priv [ level ] . nr_pages_path ) ; total_pages = orig_pages + hugetlb_priv [ level ] . pages_delta ; snprintf ( cmd_buf , MAX_PATH_LEN , " " , total_pages , hugetlb_priv [ level ] . nr_pages_path ) ; fp = popen ( cmd_buf , " " ) ; if ( fp == NULL ) { pr_err ( " \n " , cmd_buf ) ; return ; } pclose ( fp ) ; pr_info ( " \n " , orig_pages , cmd_buf ) ; cur_pages = read_sys_info ( hugetlb_priv [ level ] . nr_pages_path ) ; hugetlb_priv [ level ] . pages_delta = total_pages - cur_pages ; }
try to reserve more huge pages on the level
try to reserve more huge pages on the level
/* system cmd to reserve needed huge pages */