Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
#ifndef __LINUX_PREEMPT_H
2
#define __LINUX_PREEMPT_H
3
 
4
/*
5
 * include/linux/preempt.h - macros for accessing and manipulating
6
 * preempt_count (used for kernel preemption, interrupt count, etc.)
7
 */
8
 
9
#include <linux/config.h>
10
 
11
#define preempt_count() (current_thread_info()->preempt_count)
12
 
13
#define inc_preempt_count() \
14
do { \
15
        preempt_count()++; \
16
} while (0)
17
 
18
#define dec_preempt_count() \
19
do { \
20
        preempt_count()--; \
21
} while (0)
22
 
23
#ifdef CONFIG_PREEMPT
24
 
25
extern void preempt_schedule(void);
26
 
27
#define preempt_disable() \
28
do { \
29
        inc_preempt_count(); \
30
        barrier(); \
31
} while (0)
32
 
33
#define preempt_enable_no_resched() \
34
do { \
35
        barrier(); \
36
        dec_preempt_count(); \
37
} while (0)
38
 
39
#define preempt_check_resched() \
40
do { \
41
        if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
42
                preempt_schedule(); \
43
} while (0)
44
 
45
#define preempt_enable() \
46
do { \
47
        preempt_enable_no_resched(); \
48
        preempt_check_resched(); \
49
} while (0)
50
 
51
#else
52
 
53
#define preempt_disable()               do { } while (0)
54
#define preempt_enable_no_resched()     do { } while (0)
55
#define preempt_enable()                do { } while (0)
56
#define preempt_check_resched()         do { } while (0)
57
 
58
#endif
59
 
60
#endif /* __LINUX_PREEMPT_H */