mem: error if requesting more segments than MAX_MEMSEG
authorIntel <intel.com>
Tue, 12 Mar 2013 11:03:00 +0000 (12:03 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 25 Jul 2013 14:07:51 +0000 (16:07 +0200)
Signed-off-by: Intel
lib/librte_eal/linuxapp/eal/eal_memory.c

index 6a91f35..ec43cdc 100644 (file)
@@ -970,6 +970,18 @@ rte_eal_hugepage_init(void)
                hugepage[i].memseg_id = j;
        }
 
+       if (i < nrpages) {
+               RTE_LOG(ERR, EAL, "Can only reserve %d pages "
+                       "from %d requested\n"
+                       "Current %s=%d is not enough\n"
+                       "Please either increase it or request less amount "
+                       "of memory.\n",
+                       i, nrpages, RTE_STR(CONFIG_RTE_MAX_MEMSEG),
+                       RTE_MAX_MEMSEG);
+               return (-ENOMEM);
+       }
+       
+
        return 0;