linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
@ 2013-03-06  5:03 Vinson Lee
  2013-03-06  8:52 ` Ingo Molnar
  0 siblings, 1 reply; 10+ messages in thread
From: Vinson Lee @ 2013-03-06  5:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Vinson Lee, Arnaldo Carvalho de Melo, Ingo Molnar, Irina Tirdea,
	Paul Mackerras, Pekka Enberg, Peter Zijlstra

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 <vlee@twitter.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Irina Tirdea <irina.tirdea@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>

---
 tools/perf/bench/bench.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
index a5223e6..6263f38 100644
--- a/tools/perf/bench/bench.h
+++ b/tools/perf/bench/bench.h
@@ -1,6 +1,13 @@
 #ifndef BENCH_H
 #define BENCH_H
 
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE 14
+#endif
+#ifndef MADV_NOHUGEPAGE
+#define MADV_NOHUGEPAGE 15
+#endif
+
 extern int bench_numa(int argc, const char **argv, const char *prefix);
 extern int bench_sched_messaging(int argc, const char **argv, const char *prefix);
 extern int bench_sched_pipe(int argc, const char **argv, const char *prefix);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-06  5:03 [PATCH] perf tools: Fix LIBNUMA build with glibc 2.12 and older Vinson Lee
@ 2013-03-06  8:52 ` Ingo Molnar
  2013-03-06 23:12   ` Vinson Lee
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2013-03-06  8:52 UTC (permalink / raw)
  To: Vinson Lee
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Ingo Molnar,
	Irina Tirdea, Paul Mackerras, Pekka Enberg, Peter Zijlstra


* Vinson Lee <vlee@twitter.com> 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 <vlee@twitter.com>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Irina Tirdea <irina.tirdea@intel.com>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> 
> ---
>  tools/perf/bench/bench.h |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
> index a5223e6..6263f38 100644
> --- a/tools/perf/bench/bench.h
> +++ b/tools/perf/bench/bench.h
> @@ -1,6 +1,13 @@
>  #ifndef BENCH_H
>  #define BENCH_H
>  
> +#ifndef MADV_HUGEPAGE
> +#define MADV_HUGEPAGE 14
> +#endif
> +#ifndef MADV_NOHUGEPAGE
> +#define MADV_NOHUGEPAGE 15
> +#endif

Can we ignore Parisc which goes outside the asm-generic values of 14/15 and defines 
these as 67/68?

On Parisc 14 is MADV_16K_PAGES, 15 is unused.

Could we include <uapi/asm/mman.h> instead?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-06  8:52 ` Ingo Molnar
@ 2013-03-06 23:12   ` Vinson Lee
  2013-03-08  2:42     ` [PATCH v2] " Vinson Lee
  0 siblings, 1 reply; 10+ messages in thread
From: Vinson Lee @ 2013-03-06 23:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Ingo Molnar,
	Irina Tirdea, Paul Mackerras, Pekka Enberg, Peter Zijlstra

On Wed, Mar 6, 2013 at 12:52 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Vinson Lee <vlee@twitter.com> 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 <vlee@twitter.com>
>> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Irina Tirdea <irina.tirdea@intel.com>
>> Cc: Paul Mackerras <paulus@samba.org>
>> Cc: Pekka Enberg <penberg@kernel.org>
>> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
>>
>> ---
>>  tools/perf/bench/bench.h |    7 +++++++
>>  1 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
>> index a5223e6..6263f38 100644
>> --- a/tools/perf/bench/bench.h
>> +++ b/tools/perf/bench/bench.h
>> @@ -1,6 +1,13 @@
>>  #ifndef BENCH_H
>>  #define BENCH_H
>>
>> +#ifndef MADV_HUGEPAGE
>> +#define MADV_HUGEPAGE 14
>> +#endif
>> +#ifndef MADV_NOHUGEPAGE
>> +#define MADV_NOHUGEPAGE 15
>> +#endif
>
> Can we ignore Parisc which goes outside the asm-generic values of 14/15 and defines
> these as 67/68?
>
> On Parisc 14 is MADV_16K_PAGES, 15 is unused.
>
> Could we include <uapi/asm/mman.h> instead?
>
> Thanks,
>
>         Ingo

Including <uapi/asm/mman.h> in bench/numa.c also fixes the LIBNUMA
build for me only with WERROR=0. It adds many redefined warnings of
symbols from <sys/mman.h> such as MAP_GROWSDOWN, MAP_DENYWRITE,
MAP_EXECUTABLE. The header <sys/mman.h> cannot be removed as it is
needed for mmap.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-06 23:12   ` Vinson Lee
@ 2013-03-08  2:42     ` Vinson Lee
  2013-03-08  2:42       ` Vinson Lee
  0 siblings, 1 reply; 10+ messages in thread
From: Vinson Lee @ 2013-03-08  2:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Vinson Lee

This follow-up patch adds tokens MADV_HUGEPAGE and MADV_NOHUGEPAGE for 
Parisc, which has different values from other architectures.

Vinson Lee (1):
  perf tools: Fix LIBNUMA build with glibc 2.12 and older.

 tools/perf/bench/bench.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-08  2:42     ` [PATCH v2] " Vinson Lee
@ 2013-03-08  2:42       ` Vinson Lee
  2013-03-11  8:36         ` Ingo Molnar
  0 siblings, 1 reply; 10+ messages in thread
From: Vinson Lee @ 2013-03-08  2:42 UTC (permalink / raw)
  To: linux-kernel
  Cc: Vinson Lee, Arnaldo Carvalho de Melo, Ingo Molnar, Irina Tirdea,
	Paul Mackerras, Pekka Enberg, Peter Zijlstra

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 <vlee@twitter.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Irina Tirdea <irina.tirdea@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 tools/perf/bench/bench.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
index a5223e6..ed4ae8b 100644
--- a/tools/perf/bench/bench.h
+++ b/tools/perf/bench/bench.h
@@ -1,6 +1,22 @@
 #ifndef BENCH_H
 #define BENCH_H
 
+#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
+
 extern int bench_numa(int argc, const char **argv, const char *prefix);
 extern int bench_sched_messaging(int argc, const char **argv, const char *prefix);
 extern int bench_sched_pipe(int argc, const char **argv, const char *prefix);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-08  2:42       ` Vinson Lee
@ 2013-03-11  8:36         ` Ingo Molnar
  2013-03-13 22:34           ` [PATCH v3] " Vinson Lee
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2013-03-11  8:36 UTC (permalink / raw)
  To: Vinson Lee
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Ingo Molnar,
	Irina Tirdea, Paul Mackerras, Pekka Enberg, Peter Zijlstra


* Vinson Lee <vlee@twitter.com> 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 <vlee@twitter.com>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Irina Tirdea <irina.tirdea@intel.com>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
>  tools/perf/bench/bench.h |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
> index a5223e6..ed4ae8b 100644
> --- a/tools/perf/bench/bench.h
> +++ b/tools/perf/bench/bench.h
> @@ -1,6 +1,22 @@
>  #ifndef BENCH_H
>  #define BENCH_H
>  
> +#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

This looks good to me. Two minor stylistic nits:

 - I think we want a short comment explaining what it's about,
   that this is for old glibc and that hppa messed up its madvise() 
   constants and needs a non-generic kludge.

 - for such multi-level #ifdef blocks we generally prefer this
   more readable form:

#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,

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-11  8:36         ` Ingo Molnar
@ 2013-03-13 22:34           ` Vinson Lee
  2013-03-13 22:34             ` Vinson Lee
  0 siblings, 1 reply; 10+ messages in thread
From: Vinson Lee @ 2013-03-13 22:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Vinson Lee

Updated patch after Ingo Molnar's feedback.

- Added comments about glibc compatibility and PA-RISC special case.
- Made #ifdef blocks multi-level.

Vinson Lee (1):
  perf tools: Fix LIBNUMA build with glibc 2.12 and older.

 tools/perf/bench/bench.h |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-13 22:34           ` [PATCH v3] " Vinson Lee
@ 2013-03-13 22:34             ` Vinson Lee
  2013-03-14  7:34               ` Ingo Molnar
  2013-03-18 11:01               ` [tip:perf/urgent] " tip-bot for Vinson Lee
  0 siblings, 2 replies; 10+ messages in thread
From: Vinson Lee @ 2013-03-13 22:34 UTC (permalink / raw)
  To: linux-kernel
  Cc: Vinson Lee, Arnaldo Carvalho de Melo, Ingo Molnar, Irina Tirdea,
	Paul Mackerras, Pekka Enberg, Peter Zijlstra

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 <vlee@twitter.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Irina Tirdea <irina.tirdea@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 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
+
 extern int bench_numa(int argc, const char **argv, const char *prefix);
 extern int bench_sched_messaging(int argc, const char **argv, const char *prefix);
 extern int bench_sched_pipe(int argc, const char **argv, const char *prefix);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-13 22:34             ` Vinson Lee
@ 2013-03-14  7:34               ` Ingo Molnar
  2013-03-18 11:01               ` [tip:perf/urgent] " tip-bot for Vinson Lee
  1 sibling, 0 replies; 10+ messages in thread
From: Ingo Molnar @ 2013-03-14  7:34 UTC (permalink / raw)
  To: Vinson Lee
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Ingo Molnar,
	Irina Tirdea, Paul Mackerras, Pekka Enberg, Peter Zijlstra


* Vinson Lee <vlee@twitter.com> 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 <vlee@twitter.com>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Irina Tirdea <irina.tirdea@intel.com>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
>  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 <mingo@kernel.org>

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

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [tip:perf/urgent] perf tools: Fix LIBNUMA build with glibc 2.12 and older.
  2013-03-13 22:34             ` Vinson Lee
  2013-03-14  7:34               ` Ingo Molnar
@ 2013-03-18 11:01               ` tip-bot for Vinson Lee
  1 sibling, 0 replies; 10+ messages in thread
From: tip-bot for Vinson Lee @ 2013-03-18 11:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, mingo, hpa, mingo, a.p.zijlstra,
	penberg, irina.tirdea, tglx, vlee

Commit-ID:  d1398ccfec56e54010476efd6a316427d29045a6
Gitweb:     http://git.kernel.org/tip/d1398ccfec56e54010476efd6a316427d29045a6
Author:     Vinson Lee <vlee@twitter.com>
AuthorDate: Wed, 13 Mar 2013 15:34:24 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 14 Mar 2013 08:06:21 -0300

perf tools: Fix LIBNUMA build with glibc 2.12 and older.

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 <vlee@twitter.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Irina Tirdea <irina.tirdea@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1363214064-4671-2-git-send-email-vlee@twitter.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/bench.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h
index a5223e6..0fdc852 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
+
 extern int bench_numa(int argc, const char **argv, const char *prefix);
 extern int bench_sched_messaging(int argc, const char **argv, const char *prefix);
 extern int bench_sched_pipe(int argc, const char **argv, const char *prefix);

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-03-18 11:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-06  5:03 [PATCH] perf tools: Fix LIBNUMA build with glibc 2.12 and older Vinson Lee
2013-03-06  8:52 ` Ingo Molnar
2013-03-06 23:12   ` Vinson Lee
2013-03-08  2:42     ` [PATCH v2] " Vinson Lee
2013-03-08  2:42       ` Vinson Lee
2013-03-11  8:36         ` Ingo Molnar
2013-03-13 22:34           ` [PATCH v3] " Vinson Lee
2013-03-13 22:34             ` Vinson Lee
2013-03-14  7:34               ` Ingo Molnar
2013-03-18 11:01               ` [tip:perf/urgent] " tip-bot for Vinson Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).