Commit 0cd3142f authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf util: Remove weak sched_getcpu

sched_getcpu may not be present and so a feature test and definition
exist to workaround this in the build. The feature test is used to
define HAVE_SCHED_GETCPU_SUPPORT and so this is sufficient to know
whether the local sched_getcpu is needed and a weak symbol can be
avoided.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin Liška <mliska@suse.cz>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: Roberto Sassu <roberto.sassu@huawei.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Tom Rix <trix@redhat.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7bafa03f
...@@ -13,19 +13,6 @@ ...@@ -13,19 +13,6 @@
static unsigned long flag = PERF_FLAG_FD_CLOEXEC; static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
int __weak sched_getcpu(void)
{
#ifdef __NR_getcpu
unsigned cpu;
int err = syscall(__NR_getcpu, &cpu, NULL, NULL);
if (!err)
return cpu;
#else
errno = ENOSYS;
#endif
return -1;
}
static int perf_flag_probe(void) static int perf_flag_probe(void)
{ {
/* use 'safest' configuration as used in evsel__fallback() */ /* use 'safest' configuration as used in evsel__fallback() */
......
...@@ -533,3 +533,19 @@ int do_realloc_array_as_needed(void **arr, size_t *arr_sz, size_t x, size_t msz, ...@@ -533,3 +533,19 @@ int do_realloc_array_as_needed(void **arr, size_t *arr_sz, size_t x, size_t msz,
*arr_sz = new_sz; *arr_sz = new_sz;
return 0; return 0;
} }
#ifndef HAVE_SCHED_GETCPU_SUPPORT
int sched_getcpu(void)
{
#ifdef __NR_getcpu
unsigned int cpu;
int err = syscall(__NR_getcpu, &cpu, NULL, NULL);
if (!err)
return cpu;
#else
errno = ENOSYS;
#endif
return -1;
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment