Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
percpu.h File Reference
#include <linux/kernel.h>
#include <linux/stringify.h>
#include <asm-generic/percpu.h>

Go to the source code of this file.

Macros

#define __percpu_seg   fs
 
#define __percpu_mov_op   movl
 
#define __percpu_prefix   ""
 
#define __percpu_arg(x)   __percpu_prefix "%P" #x
 
#define DECLARE_INIT_PER_CPU(var)   extern typeof(var) init_per_cpu_var(var)
 
#define init_per_cpu_var(var)   var
 
#define percpu_to_op(op, var, val)
 
#define percpu_add_op(var, val)
 
#define percpu_from_op(op, var, constraint)
 
#define percpu_unary_op(op, var)
 
#define percpu_add_return_op(var, val)
 
#define percpu_xchg_op(var, nval)
 
#define percpu_cmpxchg_op(var, oval, nval)
 
#define this_cpu_read_stable(var)   percpu_from_op("mov", var, "p" (&(var)))
 
#define __this_cpu_read_1(pcp)   percpu_from_op("mov", (pcp), "m"(pcp))
 
#define __this_cpu_read_2(pcp)   percpu_from_op("mov", (pcp), "m"(pcp))
 
#define __this_cpu_read_4(pcp)   percpu_from_op("mov", (pcp), "m"(pcp))
 
#define __this_cpu_write_1(pcp, val)   percpu_to_op("mov", (pcp), val)
 
#define __this_cpu_write_2(pcp, val)   percpu_to_op("mov", (pcp), val)
 
#define __this_cpu_write_4(pcp, val)   percpu_to_op("mov", (pcp), val)
 
#define __this_cpu_add_1(pcp, val)   percpu_add_op((pcp), val)
 
#define __this_cpu_add_2(pcp, val)   percpu_add_op((pcp), val)
 
#define __this_cpu_add_4(pcp, val)   percpu_add_op((pcp), val)
 
#define __this_cpu_and_1(pcp, val)   percpu_to_op("and", (pcp), val)
 
#define __this_cpu_and_2(pcp, val)   percpu_to_op("and", (pcp), val)
 
#define __this_cpu_and_4(pcp, val)   percpu_to_op("and", (pcp), val)
 
#define __this_cpu_or_1(pcp, val)   percpu_to_op("or", (pcp), val)
 
#define __this_cpu_or_2(pcp, val)   percpu_to_op("or", (pcp), val)
 
#define __this_cpu_or_4(pcp, val)   percpu_to_op("or", (pcp), val)
 
#define __this_cpu_xor_1(pcp, val)   percpu_to_op("xor", (pcp), val)
 
#define __this_cpu_xor_2(pcp, val)   percpu_to_op("xor", (pcp), val)
 
#define __this_cpu_xor_4(pcp, val)   percpu_to_op("xor", (pcp), val)
 
#define __this_cpu_xchg_1(pcp, val)   percpu_xchg_op(pcp, val)
 
#define __this_cpu_xchg_2(pcp, val)   percpu_xchg_op(pcp, val)
 
#define __this_cpu_xchg_4(pcp, val)   percpu_xchg_op(pcp, val)
 
#define this_cpu_read_1(pcp)   percpu_from_op("mov", (pcp), "m"(pcp))
 
#define this_cpu_read_2(pcp)   percpu_from_op("mov", (pcp), "m"(pcp))
 
#define this_cpu_read_4(pcp)   percpu_from_op("mov", (pcp), "m"(pcp))
 
#define this_cpu_write_1(pcp, val)   percpu_to_op("mov", (pcp), val)
 
#define this_cpu_write_2(pcp, val)   percpu_to_op("mov", (pcp), val)
 
#define this_cpu_write_4(pcp, val)   percpu_to_op("mov", (pcp), val)
 
#define this_cpu_add_1(pcp, val)   percpu_add_op((pcp), val)
 
#define this_cpu_add_2(pcp, val)   percpu_add_op((pcp), val)
 
#define this_cpu_add_4(pcp, val)   percpu_add_op((pcp), val)
 
#define this_cpu_and_1(pcp, val)   percpu_to_op("and", (pcp), val)
 
#define this_cpu_and_2(pcp, val)   percpu_to_op("and", (pcp), val)
 
#define this_cpu_and_4(pcp, val)   percpu_to_op("and", (pcp), val)
 
#define this_cpu_or_1(pcp, val)   percpu_to_op("or", (pcp), val)
 
#define this_cpu_or_2(pcp, val)   percpu_to_op("or", (pcp), val)
 
#define this_cpu_or_4(pcp, val)   percpu_to_op("or", (pcp), val)
 
#define this_cpu_xor_1(pcp, val)   percpu_to_op("xor", (pcp), val)
 
#define this_cpu_xor_2(pcp, val)   percpu_to_op("xor", (pcp), val)
 
#define this_cpu_xor_4(pcp, val)   percpu_to_op("xor", (pcp), val)
 
#define this_cpu_xchg_1(pcp, nval)   percpu_xchg_op(pcp, nval)
 
#define this_cpu_xchg_2(pcp, nval)   percpu_xchg_op(pcp, nval)
 
#define this_cpu_xchg_4(pcp, nval)   percpu_xchg_op(pcp, nval)
 
#define __this_cpu_add_return_1(pcp, val)   percpu_add_return_op(pcp, val)
 
#define __this_cpu_add_return_2(pcp, val)   percpu_add_return_op(pcp, val)
 
#define __this_cpu_add_return_4(pcp, val)   percpu_add_return_op(pcp, val)
 
#define __this_cpu_cmpxchg_1(pcp, oval, nval)   percpu_cmpxchg_op(pcp, oval, nval)
 
#define __this_cpu_cmpxchg_2(pcp, oval, nval)   percpu_cmpxchg_op(pcp, oval, nval)
 
#define __this_cpu_cmpxchg_4(pcp, oval, nval)   percpu_cmpxchg_op(pcp, oval, nval)
 
#define this_cpu_add_return_1(pcp, val)   percpu_add_return_op(pcp, val)
 
#define this_cpu_add_return_2(pcp, val)   percpu_add_return_op(pcp, val)
 
#define this_cpu_add_return_4(pcp, val)   percpu_add_return_op(pcp, val)
 
#define this_cpu_cmpxchg_1(pcp, oval, nval)   percpu_cmpxchg_op(pcp, oval, nval)
 
#define this_cpu_cmpxchg_2(pcp, oval, nval)   percpu_cmpxchg_op(pcp, oval, nval)
 
#define this_cpu_cmpxchg_4(pcp, oval, nval)   percpu_cmpxchg_op(pcp, oval, nval)
 
#define x86_test_and_clear_bit_percpu(bit, var)
 
#define x86_this_cpu_test_bit(nr, addr)
 
#define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue)   DEFINE_PER_CPU(_type, _name) = _initvalue
 
#define DEFINE_EARLY_PER_CPU_READ_MOSTLY(_type, _name, _initvalue)   DEFINE_PER_CPU_READ_MOSTLY(_type, _name) = _initvalue
 
#define EXPORT_EARLY_PER_CPU_SYMBOL(_name)   EXPORT_PER_CPU_SYMBOL(_name)
 
#define DECLARE_EARLY_PER_CPU(_type, _name)   DECLARE_PER_CPU(_type, _name)
 
#define DECLARE_EARLY_PER_CPU_READ_MOSTLY(_type, _name)   DECLARE_PER_CPU_READ_MOSTLY(_type, _name)
 
#define early_per_cpu(_name, _cpu)   per_cpu(_name, _cpu)
 
#define early_per_cpu_ptr(_name)   NULL
 

Functions

void __bad_percpu_size (void)
 
 DECLARE_PER_CPU (unsigned long, this_cpu_off)
 

Macro Definition Documentation

#define __percpu_arg (   x)    __percpu_prefix "%P" #x

Definition at line 68 of file percpu.h.

#define __percpu_mov_op   movl

Definition at line 9 of file percpu.h.

#define __percpu_prefix   ""

Definition at line 65 of file percpu.h.

#define __percpu_seg   fs

Definition at line 8 of file percpu.h.

#define __this_cpu_add_1 (   pcp,
  val 
)    percpu_add_op((pcp), val)

Definition at line 371 of file percpu.h.

#define __this_cpu_add_2 (   pcp,
  val 
)    percpu_add_op((pcp), val)

Definition at line 372 of file percpu.h.

#define __this_cpu_add_4 (   pcp,
  val 
)    percpu_add_op((pcp), val)

Definition at line 373 of file percpu.h.

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

Definition at line 410 of file percpu.h.

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

Definition at line 411 of file percpu.h.

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

Definition at line 412 of file percpu.h.

#define __this_cpu_and_1 (   pcp,
  val 
)    percpu_to_op("and", (pcp), val)

Definition at line 374 of file percpu.h.

#define __this_cpu_and_2 (   pcp,
  val 
)    percpu_to_op("and", (pcp), val)

Definition at line 375 of file percpu.h.

#define __this_cpu_and_4 (   pcp,
  val 
)    percpu_to_op("and", (pcp), val)

Definition at line 376 of file percpu.h.

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

Definition at line 413 of file percpu.h.

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

Definition at line 414 of file percpu.h.

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

Definition at line 415 of file percpu.h.

#define __this_cpu_or_1 (   pcp,
  val 
)    percpu_to_op("or", (pcp), val)

Definition at line 377 of file percpu.h.

#define __this_cpu_or_2 (   pcp,
  val 
)    percpu_to_op("or", (pcp), val)

Definition at line 378 of file percpu.h.

#define __this_cpu_or_4 (   pcp,
  val 
)    percpu_to_op("or", (pcp), val)

Definition at line 379 of file percpu.h.

#define __this_cpu_read_1 (   pcp)    percpu_from_op("mov", (pcp), "m"(pcp))

Definition at line 364 of file percpu.h.

#define __this_cpu_read_2 (   pcp)    percpu_from_op("mov", (pcp), "m"(pcp))

Definition at line 365 of file percpu.h.

#define __this_cpu_read_4 (   pcp)    percpu_from_op("mov", (pcp), "m"(pcp))

Definition at line 366 of file percpu.h.

#define __this_cpu_write_1 (   pcp,
  val 
)    percpu_to_op("mov", (pcp), val)

Definition at line 368 of file percpu.h.

#define __this_cpu_write_2 (   pcp,
  val 
)    percpu_to_op("mov", (pcp), val)

Definition at line 369 of file percpu.h.

#define __this_cpu_write_4 (   pcp,
  val 
)    percpu_to_op("mov", (pcp), val)

Definition at line 370 of file percpu.h.

#define __this_cpu_xchg_1 (   pcp,
  val 
)    percpu_xchg_op(pcp, val)

Definition at line 383 of file percpu.h.

#define __this_cpu_xchg_2 (   pcp,
  val 
)    percpu_xchg_op(pcp, val)

Definition at line 384 of file percpu.h.

#define __this_cpu_xchg_4 (   pcp,
  val 
)    percpu_xchg_op(pcp, val)

Definition at line 385 of file percpu.h.

#define __this_cpu_xor_1 (   pcp,
  val 
)    percpu_to_op("xor", (pcp), val)

Definition at line 380 of file percpu.h.

#define __this_cpu_xor_2 (   pcp,
  val 
)    percpu_to_op("xor", (pcp), val)

Definition at line 381 of file percpu.h.

#define __this_cpu_xor_4 (   pcp,
  val 
)    percpu_to_op("xor", (pcp), val)

Definition at line 382 of file percpu.h.

#define DECLARE_EARLY_PER_CPU (   _type,
  _name 
)    DECLARE_PER_CPU(_type, _name)

Definition at line 590 of file percpu.h.

#define DECLARE_EARLY_PER_CPU_READ_MOSTLY (   _type,
  _name 
)    DECLARE_PER_CPU_READ_MOSTLY(_type, _name)

Definition at line 593 of file percpu.h.

#define DECLARE_INIT_PER_CPU (   var)    extern typeof(var) init_per_cpu_var(var)

Definition at line 77 of file percpu.h.

#define DEFINE_EARLY_PER_CPU (   _type,
  _name,
  _initvalue 
)    DEFINE_PER_CPU(_type, _name) = _initvalue

Definition at line 581 of file percpu.h.

#define DEFINE_EARLY_PER_CPU_READ_MOSTLY (   _type,
  _name,
  _initvalue 
)    DEFINE_PER_CPU_READ_MOSTLY(_type, _name) = _initvalue

Definition at line 584 of file percpu.h.

#define early_per_cpu (   _name,
  _cpu 
)    per_cpu(_name, _cpu)

Definition at line 596 of file percpu.h.

#define early_per_cpu_ptr (   _name)    NULL

Definition at line 597 of file percpu.h.

#define EXPORT_EARLY_PER_CPU_SYMBOL (   _name)    EXPORT_PER_CPU_SYMBOL(_name)

Definition at line 587 of file percpu.h.

#define init_per_cpu_var (   var)    var

Definition at line 83 of file percpu.h.

#define percpu_add_op (   var,
  val 
)

Definition at line 127 of file percpu.h.

#define percpu_add_return_op (   var,
  val 
)
Value:
({ \
typeof(var) paro_ret__ = val; \
switch (sizeof(var)) { \
case 1: \
asm("xaddb %0, "__percpu_arg(1) \
: "+q" (paro_ret__), "+m" (var) \
: : "memory"); \
break; \
case 2: \
asm("xaddw %0, "__percpu_arg(1) \
: "+r" (paro_ret__), "+m" (var) \
: : "memory"); \
break; \
case 4: \
asm("xaddl %0, "__percpu_arg(1) \
: "+r" (paro_ret__), "+m" (var) \
: : "memory"); \
break; \
case 8: \
asm("xaddq %0, "__percpu_arg(1) \
: "+re" (paro_ret__), "+m" (var) \
: : "memory"); \
break; \
default: __bad_percpu_size(); \
} \
paro_ret__ += val; \
paro_ret__; \
})

Definition at line 237 of file percpu.h.

#define percpu_cmpxchg_op (   var,
  oval,
  nval 
)

Definition at line 318 of file percpu.h.

#define percpu_from_op (   op,
  var,
  constraint 
)
Value:
({ \
typeof(var) pfo_ret__; \
switch (sizeof(var)) { \
case 1: \
asm(op "b "__percpu_arg(1)",%0" \
: "=q" (pfo_ret__) \
: constraint); \
break; \
case 2: \
asm(op "w "__percpu_arg(1)",%0" \
: "=r" (pfo_ret__) \
: constraint); \
break; \
case 4: \
asm(op "l "__percpu_arg(1)",%0" \
: "=r" (pfo_ret__) \
: constraint); \
break; \
case 8: \
asm(op "q "__percpu_arg(1)",%0" \
: "=r" (pfo_ret__) \
: constraint); \
break; \
default: __bad_percpu_size(); \
} \
pfo_ret__; \
})

Definition at line 182 of file percpu.h.

#define percpu_to_op (   op,
  var,
  val 
)

Definition at line 90 of file percpu.h.

#define percpu_unary_op (   op,
  var 
)
Value:
({ \
switch (sizeof(var)) { \
case 1: \
asm(op "b "__percpu_arg(0) \
: "+m" (var)); \
break; \
case 2: \
asm(op "w "__percpu_arg(0) \
: "+m" (var)); \
break; \
case 4: \
asm(op "l "__percpu_arg(0) \
: "+m" (var)); \
break; \
case 8: \
asm(op "q "__percpu_arg(0) \
: "+m" (var)); \
break; \
default: __bad_percpu_size(); \
} \
})

Definition at line 211 of file percpu.h.

#define percpu_xchg_op (   var,
  nval 
)

Definition at line 272 of file percpu.h.

#define this_cpu_add_1 (   pcp,
  val 
)    percpu_add_op((pcp), val)

Definition at line 393 of file percpu.h.

#define this_cpu_add_2 (   pcp,
  val 
)    percpu_add_op((pcp), val)

Definition at line 394 of file percpu.h.

#define this_cpu_add_4 (   pcp,
  val 
)    percpu_add_op((pcp), val)

Definition at line 395 of file percpu.h.

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

Definition at line 417 of file percpu.h.

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

Definition at line 418 of file percpu.h.

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

Definition at line 419 of file percpu.h.

#define this_cpu_and_1 (   pcp,
  val 
)    percpu_to_op("and", (pcp), val)

Definition at line 396 of file percpu.h.

#define this_cpu_and_2 (   pcp,
  val 
)    percpu_to_op("and", (pcp), val)

Definition at line 397 of file percpu.h.

#define this_cpu_and_4 (   pcp,
  val 
)    percpu_to_op("and", (pcp), val)

Definition at line 398 of file percpu.h.

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

Definition at line 420 of file percpu.h.

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

Definition at line 421 of file percpu.h.

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

Definition at line 422 of file percpu.h.

#define this_cpu_or_1 (   pcp,
  val 
)    percpu_to_op("or", (pcp), val)

Definition at line 399 of file percpu.h.

#define this_cpu_or_2 (   pcp,
  val 
)    percpu_to_op("or", (pcp), val)

Definition at line 400 of file percpu.h.

#define this_cpu_or_4 (   pcp,
  val 
)    percpu_to_op("or", (pcp), val)

Definition at line 401 of file percpu.h.

#define this_cpu_read_1 (   pcp)    percpu_from_op("mov", (pcp), "m"(pcp))

Definition at line 387 of file percpu.h.

#define this_cpu_read_2 (   pcp)    percpu_from_op("mov", (pcp), "m"(pcp))

Definition at line 388 of file percpu.h.

#define this_cpu_read_4 (   pcp)    percpu_from_op("mov", (pcp), "m"(pcp))

Definition at line 389 of file percpu.h.

#define this_cpu_read_stable (   var)    percpu_from_op("mov", var, "p" (&(var)))

Definition at line 362 of file percpu.h.

#define this_cpu_write_1 (   pcp,
  val 
)    percpu_to_op("mov", (pcp), val)

Definition at line 390 of file percpu.h.

#define this_cpu_write_2 (   pcp,
  val 
)    percpu_to_op("mov", (pcp), val)

Definition at line 391 of file percpu.h.

#define this_cpu_write_4 (   pcp,
  val 
)    percpu_to_op("mov", (pcp), val)

Definition at line 392 of file percpu.h.

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

Definition at line 405 of file percpu.h.

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

Definition at line 406 of file percpu.h.

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

Definition at line 407 of file percpu.h.

#define this_cpu_xor_1 (   pcp,
  val 
)    percpu_to_op("xor", (pcp), val)

Definition at line 402 of file percpu.h.

#define this_cpu_xor_2 (   pcp,
  val 
)    percpu_to_op("xor", (pcp), val)

Definition at line 403 of file percpu.h.

#define this_cpu_xor_4 (   pcp,
  val 
)    percpu_to_op("xor", (pcp), val)

Definition at line 404 of file percpu.h.

#define x86_test_and_clear_bit_percpu (   bit,
  var 
)
Value:
({ \
int old__; \
asm volatile("btr %2,"__percpu_arg(1)"\n\tsbbl %0,%0" \
: "=r" (old__), "+m" (var) \
: "dIr" (bit)); \
old__; \
})

Definition at line 493 of file percpu.h.

#define x86_this_cpu_test_bit (   nr,
  addr 
)
Value:
(__builtin_constant_p((nr)) \
? x86_this_cpu_constant_test_bit((nr), (addr)) \
: x86_this_cpu_variable_test_bit((nr), (addr)))

Definition at line 527 of file percpu.h.

Function Documentation

void __bad_percpu_size ( void  )
DECLARE_PER_CPU ( unsigned  long,
this_cpu_off   
)