62fde54123
The roles of the various percpu header files has become unclear. There are four header files involved. include/linux/percpu-defs.h include/linux/percpu.h include/asm-generic/percpu.h arch/*/include/asm/percpu.h The original intention for include/asm-generic/percpu.h is providing generic definitions for arch-overridable parts; however, it now hosts various stuff which can't be overridden by archs. Also, include/linux/percpu-defs.h was initially added to contain section and percpu variable definition macros so that arch header files can make use of them without worrying about introducing cyclic inclusion dependency by including include/linux/percpu.h; however, arch headers sometimes need to access percpu variables too and this is one of the reasons why some accessors were implemented in include/linux/asm-generic/percpu.h. Let's clear up the situation by making include/asm-generic/percpu.h contain only arch-overridable parts and moving accessors and operations into include/linux/percpu-defs. Note that this patch only moves things from include/asm-generic/percpu.h. include/linux/percpu.h will be taken care of by later patches. This patch moves the followings. * SHIFT_PERCPU_PTR() / VERIFY_PERCPU_PTR() * per_cpu() * raw_cpu_ptr() * this_cpu_ptr() * __get_cpu_var() * __raw_get_cpu_var() * __this_cpu_ptr() * PER_CPU_[SHARED_]ALIGNED_SECTION * PER_CPU_[SHARED_]ALIGNED_SECTION * PER_CPU_FIRST_SECTION This patch is pure reorganization. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Christoph Lameter <cl@linux.com>
69 lines
1.6 KiB
C
69 lines
1.6 KiB
C
#ifndef _ASM_GENERIC_PERCPU_H_
|
|
#define _ASM_GENERIC_PERCPU_H_
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/threads.h>
|
|
#include <linux/percpu-defs.h>
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
/*
|
|
* per_cpu_offset() is the offset that has to be added to a
|
|
* percpu variable to get to the instance for a certain processor.
|
|
*
|
|
* Most arches use the __per_cpu_offset array for those offsets but
|
|
* some arches have their own ways of determining the offset (x86_64, s390).
|
|
*/
|
|
#ifndef __per_cpu_offset
|
|
extern unsigned long __per_cpu_offset[NR_CPUS];
|
|
|
|
#define per_cpu_offset(x) (__per_cpu_offset[x])
|
|
#endif
|
|
|
|
/*
|
|
* Determine the offset for the currently active processor.
|
|
* An arch may define __my_cpu_offset to provide a more effective
|
|
* means of obtaining the offset to the per cpu variables of the
|
|
* current processor.
|
|
*/
|
|
#ifndef __my_cpu_offset
|
|
#define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
|
|
#endif
|
|
#ifdef CONFIG_DEBUG_PREEMPT
|
|
#define my_cpu_offset per_cpu_offset(smp_processor_id())
|
|
#else
|
|
#define my_cpu_offset __my_cpu_offset
|
|
#endif
|
|
|
|
/*
|
|
* Arch may define arch_raw_cpu_ptr() to provide more efficient address
|
|
* translations for raw_cpu_ptr().
|
|
*/
|
|
#ifndef arch_raw_cpu_ptr
|
|
#define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
|
|
#endif
|
|
|
|
#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
|
|
extern void setup_per_cpu_areas(void);
|
|
#endif
|
|
|
|
#endif /* SMP */
|
|
|
|
#ifndef PER_CPU_BASE_SECTION
|
|
#ifdef CONFIG_SMP
|
|
#define PER_CPU_BASE_SECTION ".data..percpu"
|
|
#else
|
|
#define PER_CPU_BASE_SECTION ".data"
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef PER_CPU_ATTRIBUTES
|
|
#define PER_CPU_ATTRIBUTES
|
|
#endif
|
|
|
|
#ifndef PER_CPU_DEF_ATTRIBUTES
|
|
#define PER_CPU_DEF_ATTRIBUTES
|
|
#endif
|
|
|
|
#endif /* _ASM_GENERIC_PERCPU_H_ */
|