mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
0ac25fd0a0
With the movement of lots of stuff out of perf.h to other headers we ended up not needing it in lots of places, remove it from those places. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-c718m0sxxwp73lp9d8vpihb4@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
26 lines
568 B
C
26 lines
568 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include "cacheline.h"
|
|
#include <unistd.h>
|
|
|
|
#ifdef _SC_LEVEL1_DCACHE_LINESIZE
|
|
#define cache_line_size(cacheline_sizep) *cacheline_sizep = sysconf(_SC_LEVEL1_DCACHE_LINESIZE)
|
|
#else
|
|
#include <api/fs/fs.h>
|
|
#include "debug.h"
|
|
static void cache_line_size(int *cacheline_sizep)
|
|
{
|
|
if (sysfs__read_int("devices/system/cpu/cpu0/cache/index0/coherency_line_size", cacheline_sizep))
|
|
pr_debug("cannot determine cache line size");
|
|
}
|
|
#endif
|
|
|
|
int cacheline_size(void)
|
|
{
|
|
static int size;
|
|
|
|
if (!size)
|
|
cache_line_size(&size);
|
|
|
|
return size;
|
|
}
|