# endif
TUNABLE_GET (mxfast, size_t, TUNABLE_CALLBACK (set_mxfast));
TUNABLE_GET (hugetlb, size_t, TUNABLE_CALLBACK (set_hugetlb));
+ if (mp_.hp_pagesize > 0)
+ /* Force mmap for main arena instead of sbrk, so hugepages are explicitly
+ used. */
+ __always_fail_morecore = true;
#else
if (__glibc_likely (_environ != NULL))
{
segregated mmap region.
*/
- char *mbrk = sysmalloc_mmap_fallback (&size, nb, old_size, pagesize,
- MMAP_AS_MORECORE_SIZE, 0, av);
+ char *mbrk = MAP_FAILED;
+#if HAVE_TUNABLES
+ if (mp_.hp_pagesize > 0)
+ mbrk = sysmalloc_mmap_fallback (&size, nb, old_size,
+ mp_.hp_pagesize, mp_.hp_pagesize,
+ mp_.hp_flags, av);
+#endif
+ if (mbrk == MAP_FAILED)
+ mbrk = sysmalloc_mmap_fallback (&size, nb, old_size, pagesize,
+ MMAP_AS_MORECORE_SIZE, 0, av);
if (mbrk != MAP_FAILED)
{
/* We do not need, and cannot use, another sbrk call to find end */
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#if defined(SHARED) || defined(USE_MTAG)
static bool __always_fail_morecore = false;
-#endif
/* Allocate INCREMENT more bytes of data space,
and return the start of data space, or NULL on errors.
void *
__glibc_morecore (ptrdiff_t increment)
{
-#if defined(SHARED) || defined(USE_MTAG)
if (__always_fail_morecore)
return NULL;
-#endif
void *result = (void *) __sbrk (increment);
if (result == (void *) -1)