Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
mutex_32.h File Reference
#include <asm/alternative.h>

Go to the source code of this file.

Macros

#define __mutex_fastpath_lock(count, fail_fn)
 
#define __mutex_fastpath_unlock(count, fail_fn)
 
#define __mutex_slowpath_needs_to_unlock()   1
 

Macro Definition Documentation

#define __mutex_fastpath_lock (   count,
  fail_fn 
)
Value:
do { \
unsigned int dummy; \
typecheck_fn(void (*)(atomic_t *), fail_fn); \
\
asm volatile(LOCK_PREFIX " decl (%%eax)\n" \
" jns 1f \n" \
" call " #fail_fn "\n" \
"1:\n" \
: "=a" (dummy) \
: "a" (count) \
: "memory", "ecx", "edx"); \
} while (0)

Definition at line 24 of file mutex_32.h.

#define __mutex_fastpath_unlock (   count,
  fail_fn 
)
Value:
do { \
unsigned int dummy; \
typecheck_fn(void (*)(atomic_t *), fail_fn); \
\
asm volatile(LOCK_PREFIX " incl (%%eax)\n" \
" jg 1f\n" \
" call " #fail_fn "\n" \
"1:\n" \
: "=a" (dummy) \
: "a" (count) \
: "memory", "ecx", "edx"); \
} while (0)

__mutex_fastpath_unlock - try to promote the mutex from 0 to 1 : pointer of type atomic_t : function to call if the original value was not 0

try to promote the mutex from 0 to 1. if it wasn't 0, call <fail_fn>. In the failure case, this function is allowed to either set the value to 1, or to set it to a value lower than 1.

If the implementation sets it to a value of lower than 1, the __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs to return 0 otherwise.

Definition at line 73 of file mutex_32.h.

#define __mutex_slowpath_needs_to_unlock ( )    1

Definition at line 89 of file mutex_32.h.