diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/preempt.h | 35 | ||||
-rw-r--r-- | include/linux/math64.h | 30 | ||||
-rw-r--r-- | include/linux/sched.h | 5 | ||||
-rw-r--r-- | include/linux/skbuff.h | 5 | ||||
-rw-r--r-- | include/uapi/drm/vmwgfx_drm.h | 1 |
5 files changed, 49 insertions, 27 deletions
diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h index ddf2b420ac8f..1cd3f5d767a8 100644 --- a/include/asm-generic/preempt.h +++ b/include/asm-generic/preempt.h | |||
@@ -3,13 +3,11 @@ | |||
3 | 3 | ||
4 | #include <linux/thread_info.h> | 4 | #include <linux/thread_info.h> |
5 | 5 | ||
6 | /* | 6 | #define PREEMPT_ENABLED (0) |
7 | * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users | 7 | |
8 | * that think a non-zero value indicates we cannot preempt. | ||
9 | */ | ||
10 | static __always_inline int preempt_count(void) | 8 | static __always_inline int preempt_count(void) |
11 | { | 9 | { |
12 | return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED; | 10 | return current_thread_info()->preempt_count; |
13 | } | 11 | } |
14 | 12 | ||
15 | static __always_inline int *preempt_count_ptr(void) | 13 | static __always_inline int *preempt_count_ptr(void) |
@@ -17,11 +15,6 @@ static __always_inline int *preempt_count_ptr(void) | |||
17 | return ¤t_thread_info()->preempt_count; | 15 | return ¤t_thread_info()->preempt_count; |
18 | } | 16 | } |
19 | 17 | ||
20 | /* | ||
21 | * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the | ||
22 | * alternative is loosing a reschedule. Better schedule too often -- also this | ||
23 | * should be a very rare operation. | ||
24 | */ | ||
25 | static __always_inline void preempt_count_set(int pc) | 18 | static __always_inline void preempt_count_set(int pc) |
26 | { | 19 | { |
27 | *preempt_count_ptr() = pc; | 20 | *preempt_count_ptr() = pc; |
@@ -41,28 +34,17 @@ static __always_inline void preempt_count_set(int pc) | |||
41 | task_thread_info(p)->preempt_count = PREEMPT_ENABLED; \ | 34 | task_thread_info(p)->preempt_count = PREEMPT_ENABLED; \ |
42 | } while (0) | 35 | } while (0) |
43 | 36 | ||
44 | /* | ||
45 | * We fold the NEED_RESCHED bit into the preempt count such that | ||
46 | * preempt_enable() can decrement and test for needing to reschedule with a | ||
47 | * single instruction. | ||
48 | * | ||
49 | * We invert the actual bit, so that when the decrement hits 0 we know we both | ||
50 | * need to resched (the bit is cleared) and can resched (no preempt count). | ||
51 | */ | ||
52 | |||
53 | static __always_inline void set_preempt_need_resched(void) | 37 | static __always_inline void set_preempt_need_resched(void) |
54 | { | 38 | { |
55 | *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED; | ||
56 | } | 39 | } |
57 | 40 | ||
58 | static __always_inline void clear_preempt_need_resched(void) | 41 | static __always_inline void clear_preempt_need_resched(void) |
59 | { | 42 | { |
60 | *preempt_count_ptr() |= PREEMPT_NEED_RESCHED; | ||
61 | } | 43 | } |
62 | 44 | ||
63 | static __always_inline bool test_preempt_need_resched(void) | 45 | static __always_inline bool test_preempt_need_resched(void) |
64 | { | 46 | { |
65 | return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED); | 47 | return false; |
66 | } | 48 | } |
67 | 49 | ||
68 | /* | 50 | /* |
@@ -81,7 +63,12 @@ static __always_inline void __preempt_count_sub(int val) | |||
81 | 63 | ||
82 | static __always_inline bool __preempt_count_dec_and_test(void) | 64 | static __always_inline bool __preempt_count_dec_and_test(void) |
83 | { | 65 | { |
84 | return !--*preempt_count_ptr(); | 66 | /* |
67 | * Because of load-store architectures cannot do per-cpu atomic | ||
68 | * operations; we cannot use PREEMPT_NEED_RESCHED because it might get | ||
69 | * lost. | ||
70 | */ | ||
71 | return !--*preempt_count_ptr() && tif_need_resched(); | ||
85 | } | 72 | } |
86 | 73 | ||
87 | /* | 74 | /* |
@@ -89,7 +76,7 @@ static __always_inline bool __preempt_count_dec_and_test(void) | |||
89 | */ | 76 | */ |
90 | static __always_inline bool should_resched(void) | 77 | static __always_inline bool should_resched(void) |
91 | { | 78 | { |
92 | return unlikely(!*preempt_count_ptr()); | 79 | return unlikely(!preempt_count() && tif_need_resched()); |
93 | } | 80 | } |
94 | 81 | ||
95 | #ifdef CONFIG_PREEMPT | 82 | #ifdef CONFIG_PREEMPT |
diff --git a/include/linux/math64.h b/include/linux/math64.h index 69ed5f5e9f6e..c45c089bfdac 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h | |||
@@ -133,4 +133,34 @@ __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) | |||
133 | return ret; | 133 | return ret; |
134 | } | 134 | } |
135 | 135 | ||
136 | #if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__) | ||
137 | |||
138 | #ifndef mul_u64_u32_shr | ||
139 | static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift) | ||
140 | { | ||
141 | return (u64)(((unsigned __int128)a * mul) >> shift); | ||
142 | } | ||
143 | #endif /* mul_u64_u32_shr */ | ||
144 | |||
145 | #else | ||
146 | |||
147 | #ifndef mul_u64_u32_shr | ||
148 | static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift) | ||
149 | { | ||
150 | u32 ah, al; | ||
151 | u64 ret; | ||
152 | |||
153 | al = a; | ||
154 | ah = a >> 32; | ||
155 | |||
156 | ret = ((u64)al * mul) >> shift; | ||
157 | if (ah) | ||
158 | ret += ((u64)ah * mul) << (32 - shift); | ||
159 | |||
160 | return ret; | ||
161 | } | ||
162 | #endif /* mul_u64_u32_shr */ | ||
163 | |||
164 | #endif | ||
165 | |||
136 | #endif /* _LINUX_MATH64_H */ | 166 | #endif /* _LINUX_MATH64_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 768b037dfacb..53f97eb8dbc7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -440,8 +440,6 @@ struct task_cputime { | |||
440 | .sum_exec_runtime = 0, \ | 440 | .sum_exec_runtime = 0, \ |
441 | } | 441 | } |
442 | 442 | ||
443 | #define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED) | ||
444 | |||
445 | #ifdef CONFIG_PREEMPT_COUNT | 443 | #ifdef CONFIG_PREEMPT_COUNT |
446 | #define PREEMPT_DISABLED (1 + PREEMPT_ENABLED) | 444 | #define PREEMPT_DISABLED (1 + PREEMPT_ENABLED) |
447 | #else | 445 | #else |
@@ -932,7 +930,8 @@ struct pipe_inode_info; | |||
932 | struct uts_namespace; | 930 | struct uts_namespace; |
933 | 931 | ||
934 | struct load_weight { | 932 | struct load_weight { |
935 | unsigned long weight, inv_weight; | 933 | unsigned long weight; |
934 | u32 inv_weight; | ||
936 | }; | 935 | }; |
937 | 936 | ||
938 | struct sched_avg { | 937 | struct sched_avg { |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 215b5ea1cb30..6aae83890520 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1638,6 +1638,11 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) | |||
1638 | skb->mac_header += offset; | 1638 | skb->mac_header += offset; |
1639 | } | 1639 | } |
1640 | 1640 | ||
1641 | static inline void skb_pop_mac_header(struct sk_buff *skb) | ||
1642 | { | ||
1643 | skb->mac_header = skb->network_header; | ||
1644 | } | ||
1645 | |||
1641 | static inline void skb_probe_transport_header(struct sk_buff *skb, | 1646 | static inline void skb_probe_transport_header(struct sk_buff *skb, |
1642 | const int offset_hint) | 1647 | const int offset_hint) |
1643 | { | 1648 | { |
diff --git a/include/uapi/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h index bcb0912afe7a..f854ca4a1372 100644 --- a/include/uapi/drm/vmwgfx_drm.h +++ b/include/uapi/drm/vmwgfx_drm.h | |||
@@ -75,6 +75,7 @@ | |||
75 | #define DRM_VMW_PARAM_FIFO_CAPS 4 | 75 | #define DRM_VMW_PARAM_FIFO_CAPS 4 |
76 | #define DRM_VMW_PARAM_MAX_FB_SIZE 5 | 76 | #define DRM_VMW_PARAM_MAX_FB_SIZE 5 |
77 | #define DRM_VMW_PARAM_FIFO_HW_VERSION 6 | 77 | #define DRM_VMW_PARAM_FIFO_HW_VERSION 6 |
78 | #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7 | ||
78 | 79 | ||
79 | /** | 80 | /** |
80 | * struct drm_vmw_getparam_arg | 81 | * struct drm_vmw_getparam_arg |