+ /* Check if huge page is not allocated,
+ wrong allocation will generate the SIGBUS */
+ if (a->log2_subpage_sz != pm->sys_log2_page_sz)
+ {
+ for (int i = 0; i < n_pages; i++)
+ {
+ unsigned char flag;
+ mincore (va + i * page_size, 1, &flag);
+ // flag is 1 if the page was successfully allocated and in memory
+ if (!flag)
+ {
+ pm->error =
+ clib_error_return_unix (0,
+ "Unable to fulfill huge page allocation request");
+ goto error;
+ }
+ }
+ }
+