1From 0f548286848c70aa325c6748d80e8651389b4938 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 21 Jun 2018 19:32:59 -0700
4Subject: [PATCH] Mark glibc specific code so
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8---
9 morecore.c | 3 ++-
10 1 file changed, 2 insertions(+), 1 deletion(-)
11
12diff --git a/morecore.c b/morecore.c
13index 0eef782..d48509c 100644
14--- a/morecore.c
15+++ b/morecore.c
16@@ -364,6 +364,7 @@ void hugetlbfs_setup_morecore(void)
17
18 	INFO("setup_morecore(): heapaddr = 0x%lx\n", heapaddr);
19
20+#ifdef __GLIBC__
21 	heaptop = heapbase = (void *)heapaddr;
22 	if (__hugetlb_opts.thp_morecore)
23 		__morecore = &thp_morecore;
24@@ -371,7 +372,6 @@ void hugetlbfs_setup_morecore(void)
25 		__morecore = &hugetlbfs_morecore;
26
27 	/* Set some allocator options more appropriate for hugepages */
28-
29 	if (__hugetlb_opts.shrink_ok)
30 		mallopt(M_TRIM_THRESHOLD, hpage_size + hpage_size / 2);
31 	else
32@@ -381,4 +381,5 @@ void hugetlbfs_setup_morecore(void)
33 	 * This doesn't appear to prohibit malloc() from falling back
34 	 * to mmap() if we run out of hugepages. */
35 	mallopt(M_MMAP_MAX, 0);
36+#endif
37 }
38