summaryrefslogtreecommitdiff
path: root/malloc/morecore.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-08-30 14:01:00 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-12-15 17:35:39 -0300
commit0f982c182760bd7689769ee7590df592d0a132c0 (patch)
treef538197b6d1f3d2bd4eda217fccb4c824d3b5929 /malloc/morecore.c
parent0849eed45daabf30a02c153695041597d6d43b2d (diff)
downloadglibc-0f982c182760bd7689769ee7590df592d0a132c0.tar.gz
malloc: Enable huge page support on main arena
This patch adds support huge page support on main arena allocation, enable with tunable glibc.malloc.hugetlb=2. The patch essentially disable the __glibc_morecore() sbrk() call (similar when memory tag does when sbrk() call does not support it) and fallback to default page size if the memory allocation fails. Checked on x86_64-linux-gnu. Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'malloc/morecore.c')
-rw-r--r--malloc/morecore.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/malloc/morecore.c b/malloc/morecore.c
index 8168ef158c..004cd3ead4 100644
--- a/malloc/morecore.c
+++ b/malloc/morecore.c
@@ -15,9 +15,7 @@
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.
@@ -25,10 +23,8 @@ static bool __always_fail_morecore = false;
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)