thuge-gen defines MAP_HUGE_* macros that are provided by linux/mman.h
since 4.15. Removes the macros and includes linux/mman.h instead.
Signed-off-by: Edward Liaw <edliaw@google.com>
---
tools/testing/selftests/mm/thuge-gen.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c
index ea7fd8fe2876..034635317935 100644
--- a/tools/testing/selftests/mm/thuge-gen.c
+++ b/tools/testing/selftests/mm/thuge-gen.c
@@ -15,6 +15,7 @@
#define _GNU_SOURCE 1
#include <sys/mman.h>
+#include <linux/mman.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/ipc.h>
@@ -28,10 +29,6 @@
#include "vm_util.h"
#include "../kselftest.h"
-#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
-#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
-#define MAP_HUGE_SHIFT 26
-#define MAP_HUGE_MASK 0x3f
#if !defined(MAP_HUGETLB)
#define MAP_HUGETLB 0x40000
#endif
--
2.45.1.467.gbab1589fc0-goog
On 6/6/24 3:36 AM, Edward Liaw wrote: > thuge-gen defines MAP_HUGE_* macros that are provided by linux/mman.h > since 4.15. Removes the macros and includes linux/mman.h instead. > > Signed-off-by: Edward Liaw <edliaw@google.com> > --- > tools/testing/selftests/mm/thuge-gen.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c > index ea7fd8fe2876..034635317935 100644 > --- a/tools/testing/selftests/mm/thuge-gen.c > +++ b/tools/testing/selftests/mm/thuge-gen.c > @@ -15,6 +15,7 @@ > > #define _GNU_SOURCE 1 > #include <sys/mman.h> > +#include <linux/mman.h> > #include <stdlib.h> > #include <stdio.h> > #include <sys/ipc.h> > @@ -28,10 +29,6 @@ > #include "vm_util.h" > #include "../kselftest.h" > > -#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) > -#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT) > -#define MAP_HUGE_SHIFT 26 > -#define MAP_HUGE_MASK 0x3f Totally makes sense. Reviewed-by: Muhammad Usama Anjum <usama.anju@collabora.com> > #if !defined(MAP_HUGETLB) > #define MAP_HUGETLB 0x40000 > #endif -- BR, Muhammad Usama Anjum
On 6/7/24 2:44 PM, Muhammad Usama Anjum wrote: > On 6/6/24 3:36 AM, Edward Liaw wrote: >> thuge-gen defines MAP_HUGE_* macros that are provided by linux/mman.h >> since 4.15. Removes the macros and includes linux/mman.h instead. >> >> Signed-off-by: Edward Liaw <edliaw@google.com> >> --- >> tools/testing/selftests/mm/thuge-gen.c | 5 +---- >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c >> index ea7fd8fe2876..034635317935 100644 >> --- a/tools/testing/selftests/mm/thuge-gen.c >> +++ b/tools/testing/selftests/mm/thuge-gen.c >> @@ -15,6 +15,7 @@ >> >> #define _GNU_SOURCE 1 >> #include <sys/mman.h> >> +#include <linux/mman.h> >> #include <stdlib.h> >> #include <stdio.h> >> #include <sys/ipc.h> >> @@ -28,10 +29,6 @@ >> #include "vm_util.h" >> #include "../kselftest.h" >> >> -#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) >> -#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT) >> -#define MAP_HUGE_SHIFT 26 >> -#define MAP_HUGE_MASK 0x3f > Totally makes sense. > Reviewed-by: Muhammad Usama Anjum <usama.anju@collabora.com> Fixing typo: Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com> > >> #if !defined(MAP_HUGETLB) >> #define MAP_HUGETLB 0x40000 >> #endif > -- BR, Muhammad Usama Anjum
On Wed, Jun 05, 2024 at 10:36:34PM +0000, Edward Liaw wrote: > thuge-gen defines MAP_HUGE_* macros that are provided by linux/mman.h > since 4.15. Removes the macros and includes linux/mman.h instead. > > Signed-off-by: Edward Liaw <edliaw@google.com> > --- > tools/testing/selftests/mm/thuge-gen.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c > index ea7fd8fe2876..034635317935 100644 > --- a/tools/testing/selftests/mm/thuge-gen.c > +++ b/tools/testing/selftests/mm/thuge-gen.c > @@ -15,6 +15,7 @@ > > #define _GNU_SOURCE 1 > #include <sys/mman.h> > +#include <linux/mman.h> > #include <stdlib.h> > #include <stdio.h> > #include <sys/ipc.h> > @@ -28,10 +29,6 @@ > #include "vm_util.h" > #include "../kselftest.h" > > -#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) > -#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT) > -#define MAP_HUGE_SHIFT 26 > -#define MAP_HUGE_MASK 0x3f > #if !defined(MAP_HUGETLB) > #define MAP_HUGETLB 0x40000 > #endif > -- > 2.45.1.467.gbab1589fc0-goog > This makes sense to me, particularly when other mm selftests are using the same include pattern. Reviewed-by: Carlos Llamas <cmllamas@google.com>
© 2016 - 2026 Red Hat, Inc.