Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
percpu.h File Reference
#include <linux/preempt.h>
#include <linux/smp.h>
#include <linux/cpumask.h>
#include <linux/pfn.h>
#include <linux/init.h>
#include <asm/percpu.h>

Go to the source code of this file.

Data Structures

struct  pcpu_group_info
 
struct  pcpu_alloc_info
 

Macros

#define PERCPU_MODULE_RESERVE   0
 
#define PERCPU_ENOUGH_ROOM
 
#define get_cpu_var(var)
 
#define put_cpu_var(var)
 
#define get_cpu_ptr(var)
 
#define put_cpu_ptr(var)
 
#define PCPU_MIN_UNIT_SIZE   PFN_ALIGN(32 << 10)
 
#define PERCPU_DYNAMIC_EARLY_SLOTS   128
 
#define PERCPU_DYNAMIC_EARLY_SIZE   (12 << 10)
 
#define PERCPU_DYNAMIC_RESERVE   (12 << 10)
 
#define per_cpu_ptr(ptr, cpu)   ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); })
 
#define alloc_percpu(type)   (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
 
#define __pcpu_size_call_return(stem, variable)
 
#define __pcpu_size_call_return2(stem, variable,...)
 
#define __pcpu_double_call_return_bool(stem, pcp1, pcp2,...)
 
#define __pcpu_size_call(stem, variable,...)
 
#define _this_cpu_generic_read(pcp)
 
#define this_cpu_read_1(pcp)   _this_cpu_generic_read(pcp)
 
#define this_cpu_read_2(pcp)   _this_cpu_generic_read(pcp)
 
#define this_cpu_read_4(pcp)   _this_cpu_generic_read(pcp)
 
#define this_cpu_read_8(pcp)   _this_cpu_generic_read(pcp)
 
#define this_cpu_read(pcp)   __pcpu_size_call_return(this_cpu_read_, (pcp))
 
#define _this_cpu_generic_to_op(pcp, val, op)
 
#define this_cpu_write_1(pcp, val)   _this_cpu_generic_to_op((pcp), (val), =)
 
#define this_cpu_write_2(pcp, val)   _this_cpu_generic_to_op((pcp), (val), =)
 
#define this_cpu_write_4(pcp, val)   _this_cpu_generic_to_op((pcp), (val), =)
 
#define this_cpu_write_8(pcp, val)   _this_cpu_generic_to_op((pcp), (val), =)
 
#define this_cpu_write(pcp, val)   __pcpu_size_call(this_cpu_write_, (pcp), (val))
 
#define this_cpu_add_1(pcp, val)   _this_cpu_generic_to_op((pcp), (val), +=)
 
#define this_cpu_add_2(pcp, val)   _this_cpu_generic_to_op((pcp), (val), +=)
 
#define this_cpu_add_4(pcp, val)   _this_cpu_generic_to_op((pcp), (val), +=)
 
#define this_cpu_add_8(pcp, val)   _this_cpu_generic_to_op((pcp), (val), +=)
 
#define this_cpu_add(pcp, val)   __pcpu_size_call(this_cpu_add_, (pcp), (val))
 
#define this_cpu_sub(pcp, val)   this_cpu_add((pcp), -(val))
 
#define this_cpu_inc(pcp)   this_cpu_add((pcp), 1)
 
#define this_cpu_dec(pcp)   this_cpu_sub((pcp), 1)
 
#define this_cpu_and_1(pcp, val)   _this_cpu_generic_to_op((pcp), (val), &=)
 
#define this_cpu_and_2(pcp, val)   _this_cpu_generic_to_op((pcp), (val), &=)
 
#define this_cpu_and_4(pcp, val)   _this_cpu_generic_to_op((pcp), (val), &=)
 
#define this_cpu_and_8(pcp, val)   _this_cpu_generic_to_op((pcp), (val), &=)
 
#define this_cpu_and(pcp, val)   __pcpu_size_call(this_cpu_and_, (pcp), (val))
 
#define this_cpu_or_1(pcp, val)   _this_cpu_generic_to_op((pcp), (val), |=)
 
#define this_cpu_or_2(pcp, val)   _this_cpu_generic_to_op((pcp), (val), |=)
 
#define this_cpu_or_4(pcp, val)   _this_cpu_generic_to_op((pcp), (val), |=)
 
#define this_cpu_or_8(pcp, val)   _this_cpu_generic_to_op((pcp), (val), |=)
 
#define this_cpu_or(pcp, val)   __pcpu_size_call(this_cpu_or_, (pcp), (val))
 
#define this_cpu_xor_1(pcp, val)   _this_cpu_generic_to_op((pcp), (val), ^=)
 
#define this_cpu_xor_2(pcp, val)   _this_cpu_generic_to_op((pcp), (val), ^=)
 
#define this_cpu_xor_4(pcp, val)   _this_cpu_generic_to_op((pcp), (val), ^=)
 
#define this_cpu_xor_8(pcp, val)   _this_cpu_generic_to_op((pcp), (val), ^=)
 
#define this_cpu_xor(pcp, val)   __pcpu_size_call(this_cpu_or_, (pcp), (val))
 
#define _this_cpu_generic_add_return(pcp, val)
 
#define this_cpu_add_return_1(pcp, val)   _this_cpu_generic_add_return(pcp, val)
 
#define this_cpu_add_return_2(pcp, val)   _this_cpu_generic_add_return(pcp, val)
 
#define this_cpu_add_return_4(pcp, val)   _this_cpu_generic_add_return(pcp, val)
 
#define this_cpu_add_return_8(pcp, val)   _this_cpu_generic_add_return(pcp, val)
 
#define this_cpu_add_return(pcp, val)   __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
 
#define this_cpu_sub_return(pcp, val)   this_cpu_add_return(pcp, -(val))
 
#define this_cpu_inc_return(pcp)   this_cpu_add_return(pcp, 1)
 
#define this_cpu_dec_return(pcp)   this_cpu_add_return(pcp, -1)
 
#define _this_cpu_generic_xchg(pcp, nval)
 
#define this_cpu_xchg_1(pcp, nval)   _this_cpu_generic_xchg(pcp, nval)
 
#define this_cpu_xchg_2(pcp, nval)   _this_cpu_generic_xchg(pcp, nval)
 
#define this_cpu_xchg_4(pcp, nval)   _this_cpu_generic_xchg(pcp, nval)
 
#define this_cpu_xchg_8(pcp, nval)   _this_cpu_generic_xchg(pcp, nval)
 
#define this_cpu_xchg(pcp, nval)   __pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval)
 
#define _this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define this_cpu_cmpxchg_1(pcp, oval, nval)   _this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define this_cpu_cmpxchg_2(pcp, oval, nval)   _this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define this_cpu_cmpxchg_4(pcp, oval, nval)   _this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define this_cpu_cmpxchg_8(pcp, oval, nval)   _this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define this_cpu_cmpxchg(pcp, oval, nval)   __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
 
#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2)   _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2)   _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2)   _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2)   _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)   __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
 
#define __this_cpu_read_1(pcp)   (*__this_cpu_ptr(&(pcp)))
 
#define __this_cpu_read_2(pcp)   (*__this_cpu_ptr(&(pcp)))
 
#define __this_cpu_read_4(pcp)   (*__this_cpu_ptr(&(pcp)))
 
#define __this_cpu_read_8(pcp)   (*__this_cpu_ptr(&(pcp)))
 
#define __this_cpu_read(pcp)   __pcpu_size_call_return(__this_cpu_read_, (pcp))
 
#define __this_cpu_generic_to_op(pcp, val, op)
 
#define __this_cpu_write_1(pcp, val)   __this_cpu_generic_to_op((pcp), (val), =)
 
#define __this_cpu_write_2(pcp, val)   __this_cpu_generic_to_op((pcp), (val), =)
 
#define __this_cpu_write_4(pcp, val)   __this_cpu_generic_to_op((pcp), (val), =)
 
#define __this_cpu_write_8(pcp, val)   __this_cpu_generic_to_op((pcp), (val), =)
 
#define __this_cpu_write(pcp, val)   __pcpu_size_call(__this_cpu_write_, (pcp), (val))
 
#define __this_cpu_add_1(pcp, val)   __this_cpu_generic_to_op((pcp), (val), +=)
 
#define __this_cpu_add_2(pcp, val)   __this_cpu_generic_to_op((pcp), (val), +=)
 
#define __this_cpu_add_4(pcp, val)   __this_cpu_generic_to_op((pcp), (val), +=)
 
#define __this_cpu_add_8(pcp, val)   __this_cpu_generic_to_op((pcp), (val), +=)
 
#define __this_cpu_add(pcp, val)   __pcpu_size_call(__this_cpu_add_, (pcp), (val))
 
#define __this_cpu_sub(pcp, val)   __this_cpu_add((pcp), -(val))
 
#define __this_cpu_inc(pcp)   __this_cpu_add((pcp), 1)
 
#define __this_cpu_dec(pcp)   __this_cpu_sub((pcp), 1)
 
#define __this_cpu_and_1(pcp, val)   __this_cpu_generic_to_op((pcp), (val), &=)
 
#define __this_cpu_and_2(pcp, val)   __this_cpu_generic_to_op((pcp), (val), &=)
 
#define __this_cpu_and_4(pcp, val)   __this_cpu_generic_to_op((pcp), (val), &=)
 
#define __this_cpu_and_8(pcp, val)   __this_cpu_generic_to_op((pcp), (val), &=)
 
#define __this_cpu_and(pcp, val)   __pcpu_size_call(__this_cpu_and_, (pcp), (val))
 
#define __this_cpu_or_1(pcp, val)   __this_cpu_generic_to_op((pcp), (val), |=)
 
#define __this_cpu_or_2(pcp, val)   __this_cpu_generic_to_op((pcp), (val), |=)
 
#define __this_cpu_or_4(pcp, val)   __this_cpu_generic_to_op((pcp), (val), |=)
 
#define __this_cpu_or_8(pcp, val)   __this_cpu_generic_to_op((pcp), (val), |=)
 
#define __this_cpu_or(pcp, val)   __pcpu_size_call(__this_cpu_or_, (pcp), (val))
 
#define __this_cpu_xor_1(pcp, val)   __this_cpu_generic_to_op((pcp), (val), ^=)
 
#define __this_cpu_xor_2(pcp, val)   __this_cpu_generic_to_op((pcp), (val), ^=)
 
#define __this_cpu_xor_4(pcp, val)   __this_cpu_generic_to_op((pcp), (val), ^=)
 
#define __this_cpu_xor_8(pcp, val)   __this_cpu_generic_to_op((pcp), (val), ^=)
 
#define __this_cpu_xor(pcp, val)   __pcpu_size_call(__this_cpu_xor_, (pcp), (val))
 
#define __this_cpu_generic_add_return(pcp, val)
 
#define __this_cpu_add_return_1(pcp, val)   __this_cpu_generic_add_return(pcp, val)
 
#define __this_cpu_add_return_2(pcp, val)   __this_cpu_generic_add_return(pcp, val)
 
#define __this_cpu_add_return_4(pcp, val)   __this_cpu_generic_add_return(pcp, val)
 
#define __this_cpu_add_return_8(pcp, val)   __this_cpu_generic_add_return(pcp, val)
 
#define __this_cpu_add_return(pcp, val)   __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val)
 
#define __this_cpu_sub_return(pcp, val)   __this_cpu_add_return(pcp, -(val))
 
#define __this_cpu_inc_return(pcp)   __this_cpu_add_return(pcp, 1)
 
#define __this_cpu_dec_return(pcp)   __this_cpu_add_return(pcp, -1)
 
#define __this_cpu_generic_xchg(pcp, nval)
 
#define __this_cpu_xchg_1(pcp, nval)   __this_cpu_generic_xchg(pcp, nval)
 
#define __this_cpu_xchg_2(pcp, nval)   __this_cpu_generic_xchg(pcp, nval)
 
#define __this_cpu_xchg_4(pcp, nval)   __this_cpu_generic_xchg(pcp, nval)
 
#define __this_cpu_xchg_8(pcp, nval)   __this_cpu_generic_xchg(pcp, nval)
 
#define __this_cpu_xchg(pcp, nval)   __pcpu_size_call_return2(__this_cpu_xchg_, (pcp), nval)
 
#define __this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define __this_cpu_cmpxchg_1(pcp, oval, nval)   __this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define __this_cpu_cmpxchg_2(pcp, oval, nval)   __this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define __this_cpu_cmpxchg_4(pcp, oval, nval)   __this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define __this_cpu_cmpxchg_8(pcp, oval, nval)   __this_cpu_generic_cmpxchg(pcp, oval, nval)
 
#define __this_cpu_cmpxchg(pcp, oval, nval)   __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval)
 
#define __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define __this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2)   __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define __this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2)   __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define __this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2)   __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define __this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2)   __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
 
#define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)   __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
 

Typedefs

typedef void *(* pcpu_fc_alloc_fn_t )(unsigned int cpu, size_t size, size_t align)
 
typedef void(* pcpu_fc_free_fn_t )(void *ptr, size_t size)
 
typedef void(* pcpu_fc_populate_pte_fn_t )(unsigned long addr)
 
typedef intpcpu_fc_cpu_distance_fn_t )(unsigned int from, unsigned int to)
 

Enumerations

enum  pcpu_fc { PCPU_FC_AUTO, PCPU_FC_EMBED, PCPU_FC_PAGE, PCPU_FC_NR }
 

Functions

struct pcpu_alloc_info *__init pcpu_alloc_alloc_info (int nr_groups, int nr_units)
 
void __init pcpu_free_alloc_info (struct pcpu_alloc_info *ai)
 
int __init pcpu_setup_first_chunk (const struct pcpu_alloc_info *ai, void *base_addr)
 
void __percpu__alloc_reserved_percpu (size_t size, size_t align)
 
bool is_kernel_percpu_address (unsigned long addr)
 
void __init setup_per_cpu_areas (void)
 
void __init percpu_init_late (void)
 
void __percpu__alloc_percpu (size_t size, size_t align)
 
void free_percpu (void __percpu *__pdata)
 
phys_addr_t per_cpu_ptr_to_phys (void *addr)
 
void __bad_size_call_parameter (void)
 

Variables

voidpcpu_base_addr
 
const unsigned longpcpu_unit_offsets
 
const char *const pcpu_fc_names [PCPU_FC_NR]
 
enum pcpu_fc pcpu_chosen_fc
 

Macro Definition Documentation

#define __pcpu_double_call_return_bool (   stem,
  pcp1,
  pcp2,
  ... 
)
Value:
({ \
bool pdcrb_ret__; \
__verify_pcpu_ptr(&pcp1); \
BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \
VM_BUG_ON((unsigned long)(&pcp2) != \
(unsigned long)(&pcp1) + sizeof(pcp1)); \
switch(sizeof(pcp1)) { \
case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
default: \
__bad_size_call_parameter(); break; \
} \
pdcrb_ret__; \
})

Definition at line 212 of file percpu.h.

#define __pcpu_size_call (   stem,
  variable,
  ... 
)
Value:
do { \
__verify_pcpu_ptr(&(variable)); \
switch(sizeof(variable)) { \
case 1: stem##1(variable, __VA_ARGS__);break; \
case 2: stem##2(variable, __VA_ARGS__);break; \
case 4: stem##4(variable, __VA_ARGS__);break; \
case 8: stem##8(variable, __VA_ARGS__);break; \
default: \
__bad_size_call_parameter();break; \
} \
} while (0)

Definition at line 231 of file percpu.h.

#define __pcpu_size_call_return (   stem,
  variable 
)
Value:
({ typeof(variable) pscr_ret__; \
switch(sizeof(variable)) { \
case 1: pscr_ret__ = stem##1(variable);break; \
case 2: pscr_ret__ = stem##2(variable);break; \
case 4: pscr_ret__ = stem##4(variable);break; \
case 8: pscr_ret__ = stem##8(variable);break; \
default: \
__bad_size_call_parameter();break; \
} \
pscr_ret__; \
})

Definition at line 175 of file percpu.h.

#define __pcpu_size_call_return2 (   stem,
  variable,
  ... 
)
Value:
({ \
typeof(variable) pscr2_ret__; \
switch(sizeof(variable)) { \
case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \
case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \
case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \
default: \
__bad_size_call_parameter(); break; \
} \
pscr2_ret__; \
})

Definition at line 189 of file percpu.h.

#define __this_cpu_add (   pcp,
  val 
)    __pcpu_size_call(__this_cpu_add_, (pcp), (val))

Definition at line 585 of file percpu.h.

#define __this_cpu_add_1 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), +=)

Definition at line 574 of file percpu.h.

#define __this_cpu_add_2 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), +=)

Definition at line 577 of file percpu.h.

#define __this_cpu_add_4 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), +=)

Definition at line 580 of file percpu.h.

#define __this_cpu_add_8 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), +=)

Definition at line 583 of file percpu.h.

#define __this_cpu_add_return (   pcp,
  val 
)    __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val)

Definition at line 667 of file percpu.h.

#define __this_cpu_add_return_1 (   pcp,
  val 
)    __this_cpu_generic_add_return(pcp, val)

Definition at line 656 of file percpu.h.

#define __this_cpu_add_return_2 (   pcp,
  val 
)    __this_cpu_generic_add_return(pcp, val)

Definition at line 659 of file percpu.h.

#define __this_cpu_add_return_4 (   pcp,
  val 
)    __this_cpu_generic_add_return(pcp, val)

Definition at line 662 of file percpu.h.

#define __this_cpu_add_return_8 (   pcp,
  val 
)    __this_cpu_generic_add_return(pcp, val)

Definition at line 665 of file percpu.h.

#define __this_cpu_and (   pcp,
  val 
)    __pcpu_size_call(__this_cpu_and_, (pcp), (val))

Definition at line 613 of file percpu.h.

#define __this_cpu_and_1 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), &=)

Definition at line 602 of file percpu.h.

#define __this_cpu_and_2 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), &=)

Definition at line 605 of file percpu.h.

#define __this_cpu_and_4 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), &=)

Definition at line 608 of file percpu.h.

#define __this_cpu_and_8 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), &=)

Definition at line 611 of file percpu.h.

#define __this_cpu_cmpxchg (   pcp,
  oval,
  nval 
)    __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval)

Definition at line 721 of file percpu.h.

#define __this_cpu_cmpxchg_1 (   pcp,
  oval,
  nval 
)    __this_cpu_generic_cmpxchg(pcp, oval, nval)

Definition at line 710 of file percpu.h.

#define __this_cpu_cmpxchg_2 (   pcp,
  oval,
  nval 
)    __this_cpu_generic_cmpxchg(pcp, oval, nval)

Definition at line 713 of file percpu.h.

#define __this_cpu_cmpxchg_4 (   pcp,
  oval,
  nval 
)    __this_cpu_generic_cmpxchg(pcp, oval, nval)

Definition at line 716 of file percpu.h.

#define __this_cpu_cmpxchg_8 (   pcp,
  oval,
  nval 
)    __this_cpu_generic_cmpxchg(pcp, oval, nval)

Definition at line 719 of file percpu.h.

#define __this_cpu_cmpxchg_double (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))

Definition at line 754 of file percpu.h.

#define __this_cpu_cmpxchg_double_1 (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)

Definition at line 739 of file percpu.h.

#define __this_cpu_cmpxchg_double_2 (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)

Definition at line 743 of file percpu.h.

#define __this_cpu_cmpxchg_double_4 (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)

Definition at line 747 of file percpu.h.

#define __this_cpu_cmpxchg_double_8 (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)

Definition at line 751 of file percpu.h.

#define __this_cpu_dec (   pcp)    __this_cpu_sub((pcp), 1)

Definition at line 597 of file percpu.h.

#define __this_cpu_dec_return (   pcp)    __this_cpu_add_return(pcp, -1)

Definition at line 673 of file percpu.h.

#define __this_cpu_generic_add_return (   pcp,
  val 
)
Value:
({ \
__this_cpu_add(pcp, val); \
__this_cpu_read(pcp); \
})

Definition at line 648 of file percpu.h.

#define __this_cpu_generic_cmpxchg (   pcp,
  oval,
  nval 
)
Value:
({ \
typeof(pcp) ret__; \
ret__ = __this_cpu_read(pcp); \
if (ret__ == (oval)) \
__this_cpu_write(pcp, nval); \
ret__; \
})

Definition at line 699 of file percpu.h.

#define __this_cpu_generic_cmpxchg_double (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)
Value:
({ \
int __ret = 0; \
if (__this_cpu_read(pcp1) == (oval1) && \
__this_cpu_read(pcp2) == (oval2)) { \
__this_cpu_write(pcp1, (nval1)); \
__this_cpu_write(pcp2, (nval2)); \
__ret = 1; \
} \
(__ret); \
})

Definition at line 725 of file percpu.h.

#define __this_cpu_generic_to_op (   pcp,
  val,
  op 
)
Value:
do { \
*__this_cpu_ptr(&(pcp)) op val; \
} while (0)

Definition at line 551 of file percpu.h.

#define __this_cpu_generic_xchg (   pcp,
  nval 
)
Value:
({ typeof(pcp) ret__; \
ret__ = __this_cpu_read(pcp); \
__this_cpu_write(pcp, nval); \
ret__; \
})

Definition at line 675 of file percpu.h.

#define __this_cpu_inc (   pcp)    __this_cpu_add((pcp), 1)

Definition at line 593 of file percpu.h.

#define __this_cpu_inc_return (   pcp)    __this_cpu_add_return(pcp, 1)

Definition at line 672 of file percpu.h.

#define __this_cpu_or (   pcp,
  val 
)    __pcpu_size_call(__this_cpu_or_, (pcp), (val))

Definition at line 629 of file percpu.h.

#define __this_cpu_or_1 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), |=)

Definition at line 618 of file percpu.h.

#define __this_cpu_or_2 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), |=)

Definition at line 621 of file percpu.h.

#define __this_cpu_or_4 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), |=)

Definition at line 624 of file percpu.h.

#define __this_cpu_or_8 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), |=)

Definition at line 627 of file percpu.h.

#define __this_cpu_read (   pcp)    __pcpu_size_call_return(__this_cpu_read_, (pcp))

Definition at line 548 of file percpu.h.

#define __this_cpu_read_1 (   pcp)    (*__this_cpu_ptr(&(pcp)))

Definition at line 537 of file percpu.h.

#define __this_cpu_read_2 (   pcp)    (*__this_cpu_ptr(&(pcp)))

Definition at line 540 of file percpu.h.

#define __this_cpu_read_4 (   pcp)    (*__this_cpu_ptr(&(pcp)))

Definition at line 543 of file percpu.h.

#define __this_cpu_read_8 (   pcp)    (*__this_cpu_ptr(&(pcp)))

Definition at line 546 of file percpu.h.

#define __this_cpu_sub (   pcp,
  val 
)    __this_cpu_add((pcp), -(val))

Definition at line 589 of file percpu.h.

#define __this_cpu_sub_return (   pcp,
  val 
)    __this_cpu_add_return(pcp, -(val))

Definition at line 671 of file percpu.h.

#define __this_cpu_write (   pcp,
  val 
)    __pcpu_size_call(__this_cpu_write_, (pcp), (val))

Definition at line 569 of file percpu.h.

#define __this_cpu_write_1 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), =)

Definition at line 558 of file percpu.h.

#define __this_cpu_write_2 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), =)

Definition at line 561 of file percpu.h.

#define __this_cpu_write_4 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), =)

Definition at line 564 of file percpu.h.

#define __this_cpu_write_8 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), =)

Definition at line 567 of file percpu.h.

#define __this_cpu_xchg (   pcp,
  nval 
)    __pcpu_size_call_return2(__this_cpu_xchg_, (pcp), nval)

Definition at line 695 of file percpu.h.

#define __this_cpu_xchg_1 (   pcp,
  nval 
)    __this_cpu_generic_xchg(pcp, nval)

Definition at line 684 of file percpu.h.

#define __this_cpu_xchg_2 (   pcp,
  nval 
)    __this_cpu_generic_xchg(pcp, nval)

Definition at line 687 of file percpu.h.

#define __this_cpu_xchg_4 (   pcp,
  nval 
)    __this_cpu_generic_xchg(pcp, nval)

Definition at line 690 of file percpu.h.

#define __this_cpu_xchg_8 (   pcp,
  nval 
)    __this_cpu_generic_xchg(pcp, nval)

Definition at line 693 of file percpu.h.

#define __this_cpu_xor (   pcp,
  val 
)    __pcpu_size_call(__this_cpu_xor_, (pcp), (val))

Definition at line 645 of file percpu.h.

#define __this_cpu_xor_1 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), ^=)

Definition at line 634 of file percpu.h.

#define __this_cpu_xor_2 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), ^=)

Definition at line 637 of file percpu.h.

#define __this_cpu_xor_4 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), ^=)

Definition at line 640 of file percpu.h.

#define __this_cpu_xor_8 (   pcp,
  val 
)    __this_cpu_generic_to_op((pcp), (val), ^=)

Definition at line 643 of file percpu.h.

#define _this_cpu_generic_add_return (   pcp,
  val 
)
Value:
({ \
typeof(pcp) ret__; \
unsigned long flags; \
ret__ = __this_cpu_read(pcp); \
ret__; \
})

Definition at line 394 of file percpu.h.

#define _this_cpu_generic_cmpxchg (   pcp,
  oval,
  nval 
)
Value:
({ \
typeof(pcp) ret__; \
unsigned long flags; \
ret__ = __this_cpu_read(pcp); \
if (ret__ == (oval)) \
__this_cpu_write(pcp, nval); \
ret__; \
})

Definition at line 452 of file percpu.h.

#define _this_cpu_generic_cmpxchg_double (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)
Value:
({ \
int ret__; \
unsigned long flags; \
raw_local_irq_save(flags); \
ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
oval1, oval2, nval1, nval2); \
raw_local_irq_restore(flags); \
ret__; \
})

Definition at line 489 of file percpu.h.

#define _this_cpu_generic_read (   pcp)
Value:
({ typeof(pcp) ret__; \
ret__ = *this_cpu_ptr(&(pcp)); \
ret__; \
})

Definition at line 270 of file percpu.h.

#define _this_cpu_generic_to_op (   pcp,
  val,
  op 
)
Value:
do { \
unsigned long flags; \
raw_local_irq_save(flags); \
*__this_cpu_ptr(&(pcp)) op val; \
} while (0)

Definition at line 294 of file percpu.h.

#define _this_cpu_generic_xchg (   pcp,
  nval 
)
Value:
({ typeof(pcp) ret__; \
unsigned long flags; \
ret__ = __this_cpu_read(pcp); \
__this_cpu_write(pcp, nval); \
ret__; \
})

Definition at line 425 of file percpu.h.

#define alloc_percpu (   type)    (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))

Definition at line 165 of file percpu.h.

#define get_cpu_ptr (   var)
Value:
({ \
preempt_disable(); \
this_cpu_ptr(var); })

Definition at line 42 of file percpu.h.

#define get_cpu_var (   var)
Value:
(*({ \
preempt_disable(); \
&__get_cpu_var(var); }))

Definition at line 29 of file percpu.h.

#define PCPU_MIN_UNIT_SIZE   PFN_ALIGN(32 << 10)

Definition at line 52 of file percpu.h.

#define per_cpu_ptr (   ptr,
  cpu 
)    ({ (void)(cpu); VERIFY_PERCPU_PTR((ptr)); })

Definition at line 150 of file percpu.h.

#define PERCPU_DYNAMIC_EARLY_SIZE   (12 << 10)

Definition at line 62 of file percpu.h.

#define PERCPU_DYNAMIC_EARLY_SLOTS   128

Definition at line 61 of file percpu.h.

#define PERCPU_DYNAMIC_RESERVE   (12 << 10)

Definition at line 78 of file percpu.h.

#define PERCPU_ENOUGH_ROOM
Value:
(ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
PERCPU_MODULE_RESERVE)

Definition at line 20 of file percpu.h.

#define PERCPU_MODULE_RESERVE   0

Definition at line 16 of file percpu.h.

#define put_cpu_ptr (   var)
Value:
do { \
(void)(var); \
preempt_enable(); \
} while (0)

Definition at line 46 of file percpu.h.

#define put_cpu_var (   var)
Value:
do { \
(void)&(var); \
preempt_enable(); \
} while (0)

Definition at line 37 of file percpu.h.

#define this_cpu_add (   pcp,
  val 
)    __pcpu_size_call(this_cpu_add_, (pcp), (val))

Definition at line 331 of file percpu.h.

#define this_cpu_add_1 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), +=)

Definition at line 320 of file percpu.h.

#define this_cpu_add_2 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), +=)

Definition at line 323 of file percpu.h.

#define this_cpu_add_4 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), +=)

Definition at line 326 of file percpu.h.

#define this_cpu_add_8 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), +=)

Definition at line 329 of file percpu.h.

#define this_cpu_add_return (   pcp,
  val 
)    __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)

Definition at line 418 of file percpu.h.

#define this_cpu_add_return_1 (   pcp,
  val 
)    _this_cpu_generic_add_return(pcp, val)

Definition at line 407 of file percpu.h.

#define this_cpu_add_return_2 (   pcp,
  val 
)    _this_cpu_generic_add_return(pcp, val)

Definition at line 410 of file percpu.h.

#define this_cpu_add_return_4 (   pcp,
  val 
)    _this_cpu_generic_add_return(pcp, val)

Definition at line 413 of file percpu.h.

#define this_cpu_add_return_8 (   pcp,
  val 
)    _this_cpu_generic_add_return(pcp, val)

Definition at line 416 of file percpu.h.

#define this_cpu_and (   pcp,
  val 
)    __pcpu_size_call(this_cpu_and_, (pcp), (val))

Definition at line 359 of file percpu.h.

#define this_cpu_and_1 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), &=)

Definition at line 348 of file percpu.h.

#define this_cpu_and_2 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), &=)

Definition at line 351 of file percpu.h.

#define this_cpu_and_4 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), &=)

Definition at line 354 of file percpu.h.

#define this_cpu_and_8 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), &=)

Definition at line 357 of file percpu.h.

#define this_cpu_cmpxchg (   pcp,
  oval,
  nval 
)    __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)

Definition at line 477 of file percpu.h.

#define this_cpu_cmpxchg_1 (   pcp,
  oval,
  nval 
)    _this_cpu_generic_cmpxchg(pcp, oval, nval)

Definition at line 466 of file percpu.h.

#define this_cpu_cmpxchg_2 (   pcp,
  oval,
  nval 
)    _this_cpu_generic_cmpxchg(pcp, oval, nval)

Definition at line 469 of file percpu.h.

#define this_cpu_cmpxchg_4 (   pcp,
  oval,
  nval 
)    _this_cpu_generic_cmpxchg(pcp, oval, nval)

Definition at line 472 of file percpu.h.

#define this_cpu_cmpxchg_8 (   pcp,
  oval,
  nval 
)    _this_cpu_generic_cmpxchg(pcp, oval, nval)

Definition at line 475 of file percpu.h.

#define this_cpu_cmpxchg_double (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))

Definition at line 517 of file percpu.h.

#define this_cpu_cmpxchg_double_1 (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)

Definition at line 502 of file percpu.h.

#define this_cpu_cmpxchg_double_2 (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)

Definition at line 506 of file percpu.h.

#define this_cpu_cmpxchg_double_4 (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)

Definition at line 510 of file percpu.h.

#define this_cpu_cmpxchg_double_8 (   pcp1,
  pcp2,
  oval1,
  oval2,
  nval1,
  nval2 
)    _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)

Definition at line 514 of file percpu.h.

#define this_cpu_dec (   pcp)    this_cpu_sub((pcp), 1)

Definition at line 343 of file percpu.h.

#define this_cpu_dec_return (   pcp)    this_cpu_add_return(pcp, -1)

Definition at line 423 of file percpu.h.

#define this_cpu_inc (   pcp)    this_cpu_add((pcp), 1)

Definition at line 339 of file percpu.h.

#define this_cpu_inc_return (   pcp)    this_cpu_add_return(pcp, 1)

Definition at line 422 of file percpu.h.

#define this_cpu_or (   pcp,
  val 
)    __pcpu_size_call(this_cpu_or_, (pcp), (val))

Definition at line 375 of file percpu.h.

#define this_cpu_or_1 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), |=)

Definition at line 364 of file percpu.h.

#define this_cpu_or_2 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), |=)

Definition at line 367 of file percpu.h.

#define this_cpu_or_4 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), |=)

Definition at line 370 of file percpu.h.

#define this_cpu_or_8 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), |=)

Definition at line 373 of file percpu.h.

#define this_cpu_read (   pcp)    __pcpu_size_call_return(this_cpu_read_, (pcp))

Definition at line 291 of file percpu.h.

#define this_cpu_read_1 (   pcp)    _this_cpu_generic_read(pcp)

Definition at line 280 of file percpu.h.

#define this_cpu_read_2 (   pcp)    _this_cpu_generic_read(pcp)

Definition at line 283 of file percpu.h.

#define this_cpu_read_4 (   pcp)    _this_cpu_generic_read(pcp)

Definition at line 286 of file percpu.h.

#define this_cpu_read_8 (   pcp)    _this_cpu_generic_read(pcp)

Definition at line 289 of file percpu.h.

#define this_cpu_sub (   pcp,
  val 
)    this_cpu_add((pcp), -(val))

Definition at line 335 of file percpu.h.

#define this_cpu_sub_return (   pcp,
  val 
)    this_cpu_add_return(pcp, -(val))

Definition at line 421 of file percpu.h.

#define this_cpu_write (   pcp,
  val 
)    __pcpu_size_call(this_cpu_write_, (pcp), (val))

Definition at line 315 of file percpu.h.

#define this_cpu_write_1 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), =)

Definition at line 304 of file percpu.h.

#define this_cpu_write_2 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), =)

Definition at line 307 of file percpu.h.

#define this_cpu_write_4 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), =)

Definition at line 310 of file percpu.h.

#define this_cpu_write_8 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), =)

Definition at line 313 of file percpu.h.

#define this_cpu_xchg (   pcp,
  nval 
)    __pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval)

Definition at line 448 of file percpu.h.

#define this_cpu_xchg_1 (   pcp,
  nval 
)    _this_cpu_generic_xchg(pcp, nval)

Definition at line 437 of file percpu.h.

#define this_cpu_xchg_2 (   pcp,
  nval 
)    _this_cpu_generic_xchg(pcp, nval)

Definition at line 440 of file percpu.h.

#define this_cpu_xchg_4 (   pcp,
  nval 
)    _this_cpu_generic_xchg(pcp, nval)

Definition at line 443 of file percpu.h.

#define this_cpu_xchg_8 (   pcp,
  nval 
)    _this_cpu_generic_xchg(pcp, nval)

Definition at line 446 of file percpu.h.

#define this_cpu_xor (   pcp,
  val 
)    __pcpu_size_call(this_cpu_or_, (pcp), (val))

Definition at line 391 of file percpu.h.

#define this_cpu_xor_1 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), ^=)

Definition at line 380 of file percpu.h.

#define this_cpu_xor_2 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), ^=)

Definition at line 383 of file percpu.h.

#define this_cpu_xor_4 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), ^=)

Definition at line 386 of file percpu.h.

#define this_cpu_xor_8 (   pcp,
  val 
)    _this_cpu_generic_to_op((pcp), (val), ^=)

Definition at line 389 of file percpu.h.

Typedef Documentation

typedef void*(* pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size, size_t align)

Definition at line 114 of file percpu.h.

typedef int( pcpu_fc_cpu_distance_fn_t)(unsigned int from, unsigned int to)

Definition at line 118 of file percpu.h.

typedef void(* pcpu_fc_free_fn_t)(void *ptr, size_t size)

Definition at line 116 of file percpu.h.

typedef void(* pcpu_fc_populate_pte_fn_t)(unsigned long addr)

Definition at line 117 of file percpu.h.

Enumeration Type Documentation

enum pcpu_fc
Enumerator:
PCPU_FC_AUTO 
PCPU_FC_EMBED 
PCPU_FC_PAGE 
PCPU_FC_NR 

Definition at line 103 of file percpu.h.

Function Documentation

void __percpu* __alloc_percpu ( size_t  size,
size_t  align 
)

__alloc_percpu - allocate dynamic percpu area : size of area to allocate in bytes : alignment of area (max PAGE_SIZE)

Allocate zero-filled percpu area of bytes aligned at . Might sleep. Might trigger writeouts.

CONTEXT: Does GFP_KERNEL allocation.

RETURNS: Percpu pointer to the allocated area on success, NULL on failure.

Definition at line 839 of file percpu.c.

void __percpu* __alloc_reserved_percpu ( size_t  size,
size_t  align 
)

__alloc_reserved_percpu - allocate reserved percpu area : size of area to allocate in bytes : alignment of area (max PAGE_SIZE)

Allocate zero-filled percpu area of bytes aligned at from reserved percpu area if arch has set it up; otherwise, allocation is served from the same dynamic area. Might sleep. Might trigger writeouts.

CONTEXT: Does GFP_KERNEL allocation.

RETURNS: Percpu pointer to the allocated area on success, NULL on failure.

Definition at line 861 of file percpu.c.

void __bad_size_call_parameter ( void  )
void free_percpu ( void __percpu ptr)

free_percpu - free percpu area : pointer to area to free

Free percpu area .

CONTEXT: Can be called from atomic context.

Definition at line 913 of file percpu.c.

bool is_kernel_percpu_address ( unsigned long  addr)

is_kernel_percpu_address - test whether address is from static percpu area : address to test

Test whether belongs to in-kernel static percpu area. Module static percpu areas are not considered. For those, use is_module_percpu_address().

RETURNS: true if is from in-kernel static percpu area, false otherwise.

Definition at line 960 of file percpu.c.

struct pcpu_alloc_info* __init pcpu_alloc_alloc_info ( int  nr_groups,
int  nr_units 
)
read

pcpu_alloc_alloc_info - allocate percpu allocation info : the number of groups : the number of units

Allocate ai which is large enough for groups containing units. The returned ai's groups[0].cpu_map points to the cpu_map array which is long enough for and filled with NR_CPUS. It's the caller's responsibility to initialize cpu_map pointer of other groups.

RETURNS: Pointer to the allocated pcpu_alloc_info on success, NULL on failure.

Definition at line 1054 of file percpu.c.

void __init pcpu_free_alloc_info ( struct pcpu_alloc_info ai)

pcpu_free_alloc_info - free percpu allocation info : pcpu_alloc_info to free

Free which was allocated by pcpu_alloc_alloc_info().

Definition at line 1089 of file percpu.c.

int __init pcpu_setup_first_chunk ( const struct pcpu_alloc_info ai,
void base_addr 
)

pcpu_setup_first_chunk - initialize the first percpu chunk : pcpu_alloc_info describing how to percpu area is shaped : mapped address

Initialize the first percpu chunk which contains the kernel static perpcu area. This function is to be called from arch percpu area setup path.

contains all information necessary to initialize the first chunk and prime the dynamic percpu allocator.

->static_size is the size of static percpu area.

->reserved_size, if non-zero, specifies the amount of bytes to reserve after the static area in the first chunk. This reserves the first chunk such that it's available only through reserved percpu allocation. This is primarily used to serve module percpu static areas on architectures where the addressing model has limited offset range for symbol relocations to guarantee module percpu symbols fall inside the relocatable range.

->dyn_size determines the number of bytes available for dynamic allocation in the first chunk. The area between ->static_size + ->reserved_size + ->dyn_size and ->unit_size is unused.

->unit_size specifies unit size and must be aligned to PAGE_SIZE and equal to or larger than ->static_size + ->reserved_size + ->dyn_size.

->atom_size is the allocation atom size and used as alignment for vm areas.

->alloc_size is the allocation size and always multiple of ->atom_size. This is larger than ->atom_size if ->unit_size is larger than ->atom_size.

->nr_groups and ->groups describe virtual memory layout of percpu areas. Units which should be colocated are put into the same group. Dynamic VM areas will be allocated according to these groupings. If ->nr_groups is zero, a single group containing all units is assumed.

The caller should have mapped the first chunk at and copied static data to each unit.

If the first chunk ends up with both reserved and dynamic areas, it is served by two chunks - one to serve the core static and reserved areas and the other for the dynamic area. They share the same vm and page map but uses different area allocation map to stay away from each other. The latter chunk is circulated in the chunk slots and available for dynamic allocation like any other chunks.

RETURNS: 0 on success, -errno on failure.

Definition at line 1207 of file percpu.c.

phys_addr_t per_cpu_ptr_to_phys ( void addr)

per_cpu_ptr_to_phys - convert translated percpu address to physical address : the address to be converted to physical address

Given which is dereferenceable address obtained via one of percpu access macros, this function translates it into its physical address. The caller is responsible for ensuring stays valid until this function finishes.

percpu allocator has special setup for the first chunk, which currently supports either embedding in linear address space or vmalloc mapping, and, from the second one, the backing allocator (currently either vm or km) provides translation.

The addr can be tranlated simply without checking if it falls into the first chunk. But the current code reflects better how percpu allocator actually works, and the verification can discover both bugs in percpu allocator itself and per_cpu_ptr_to_phys() callers. So we keep current code.

RETURNS: The physical address for .

Definition at line 1001 of file percpu.c.

void __init percpu_init_late ( void  )

Definition at line 1920 of file percpu.c.

void __init setup_per_cpu_areas ( void  )

Definition at line 1458 of file smp_64.c.

Variable Documentation

void* pcpu_base_addr
enum pcpu_fc pcpu_chosen_fc
const char* const pcpu_fc_names[PCPU_FC_NR]
const unsigned long* pcpu_unit_offsets