* Vinson Lee <[email protected]> wrote:

> The tokens MADV_HUGEPAGE and MADV_NOHUGEPAGE are not available with
> glibc 2.12 and older. Define these tokens if they are not already
> defined.
> 
> This patch fixes these build errors with older versions of glibc.
> 
>     CC bench/numa.o
> bench/numa.c: In function ???alloc_data???:
> bench/numa.c:334: error: ???MADV_HUGEPAGE??? undeclared (first use in this 
> function)
> bench/numa.c:334: error: (Each undeclared identifier is reported only once
> bench/numa.c:334: error: for each function it appears in.)
> bench/numa.c:341: error: ???MADV_NOHUGEPAGE??? undeclared (first use in this 
> function)
> make: *** [bench/numa.o] Error 1
> 
> Signed-off-by: Vinson Lee <[email protected]>
> Cc: Arnaldo Carvalho de Melo <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Irina Tirdea <[email protected]>
> Cc: Paul Mackerras <[email protected]>
> Cc: Pekka Enberg <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> ---
>  tools/perf/bench/bench.h |   24 ++++++++++++++++++++++++
>  1 files changed, 24 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
> index a5223e6..c132ee7 100644
> --- a/tools/perf/bench/bench.h
> +++ b/tools/perf/bench/bench.h
> @@ -1,6 +1,30 @@
>  #ifndef BENCH_H
>  #define BENCH_H
>  
> +/*
> + * The madvise transparent hugepage constants were added in glibc
> + * 2.13. For compatibility with older versions of glibc, define these
> + * tokens if they are not already defined.
> + *
> + * PA-RISC uses different madvise values from other architectures and
> + * needs to be special-cased.
> + */
> +#ifdef __hppa__
> +# ifndef MADV_HUGEPAGE
> +#  define MADV_HUGEPAGE              67
> +# endif
> +# ifndef MADV_NOHUGEPAGE
> +#  define MADV_NOHUGEPAGE    68
> +# endif
> +#else
> +# ifndef MADV_HUGEPAGE
> +#  define MADV_HUGEPAGE              14
> +# endif
> +# ifndef MADV_NOHUGEPAGE
> +#  define MADV_NOHUGEPAGE    15
> +# endif
> +#endif

Thanks!

Acked-by: Ingo Molnar <[email protected]>

Arnaldo, will you be picking this up for perf/urgent, or should I?

Thanks,

        Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to