diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 11:08:43 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-26 11:08:43 -0400 |
| commit | 8a4a8918ed6e4a361f4df19f199bbc2d0a89a46c (patch) | |
| tree | d76974986aaaa8549baf2d6a106fa6cb60d64b88 /include/linux | |
| parent | 8686a0e200419322654a75155e2e6f80346a1297 (diff) | |
| parent | 540f41edc15473ca3b2876de72646546ae101374 (diff) | |
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits)
llist: Add back llist_add_batch() and llist_del_first() prototypes
sched: Don't use tasklist_lock for debug prints
sched: Warn on rt throttling
sched: Unify the ->cpus_allowed mask copy
sched: Wrap scheduler p->cpus_allowed access
sched: Request for idle balance during nohz idle load balance
sched: Use resched IPI to kick off the nohz idle balance
sched: Fix idle_cpu()
llist: Remove cpu_relax() usage in cmpxchg loops
sched: Convert to struct llist
llist: Add llist_next()
irq_work: Use llist in the struct irq_work logic
llist: Return whether list is empty before adding in llist_add()
llist: Move cpu_relax() to after the cmpxchg()
llist: Remove the platform-dependent NMI checks
llist: Make some llist functions inline
sched, tracing: Show PREEMPT_ACTIVE state in trace_sched_switch
sched: Remove redundant test in check_preempt_tick()
sched: Add documentation for bandwidth control
sched: Return unused runtime on group dequeue
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/irq_work.h | 15 | ||||
| -rw-r--r-- | include/linux/llist.h | 77 | ||||
| -rw-r--r-- | include/linux/sched.h | 7 |
3 files changed, 84 insertions, 15 deletions
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h index 4fa09d4d0b71..6a9e8f5399e2 100644 --- a/include/linux/irq_work.h +++ b/include/linux/irq_work.h | |||
| @@ -1,20 +1,23 @@ | |||
| 1 | #ifndef _LINUX_IRQ_WORK_H | 1 | #ifndef _LINUX_IRQ_WORK_H |
| 2 | #define _LINUX_IRQ_WORK_H | 2 | #define _LINUX_IRQ_WORK_H |
| 3 | 3 | ||
| 4 | #include <linux/llist.h> | ||
| 5 | |||
| 4 | struct irq_work { | 6 | struct irq_work { |
| 5 | struct irq_work *next; | 7 | unsigned long flags; |
| 8 | struct llist_node llnode; | ||
| 6 | void (*func)(struct irq_work *); | 9 | void (*func)(struct irq_work *); |
| 7 | }; | 10 | }; |
| 8 | 11 | ||
| 9 | static inline | 12 | static inline |
| 10 | void init_irq_work(struct irq_work *entry, void (*func)(struct irq_work *)) | 13 | void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *)) |
| 11 | { | 14 | { |
| 12 | entry->next = NULL; | 15 | work->flags = 0; |
| 13 | entry->func = func; | 16 | work->func = func; |
| 14 | } | 17 | } |
| 15 | 18 | ||
| 16 | bool irq_work_queue(struct irq_work *entry); | 19 | bool irq_work_queue(struct irq_work *work); |
| 17 | void irq_work_run(void); | 20 | void irq_work_run(void); |
| 18 | void irq_work_sync(struct irq_work *entry); | 21 | void irq_work_sync(struct irq_work *work); |
| 19 | 22 | ||
| 20 | #endif /* _LINUX_IRQ_WORK_H */ | 23 | #endif /* _LINUX_IRQ_WORK_H */ |
diff --git a/include/linux/llist.h b/include/linux/llist.h index aa0c8b5b3cd0..7287734e08d1 100644 --- a/include/linux/llist.h +++ b/include/linux/llist.h | |||
| @@ -35,10 +35,30 @@ | |||
| 35 | * | 35 | * |
| 36 | * The basic atomic operation of this list is cmpxchg on long. On | 36 | * The basic atomic operation of this list is cmpxchg on long. On |
| 37 | * architectures that don't have NMI-safe cmpxchg implementation, the | 37 | * architectures that don't have NMI-safe cmpxchg implementation, the |
| 38 | * list can NOT be used in NMI handler. So code uses the list in NMI | 38 | * list can NOT be used in NMI handlers. So code that uses the list in |
| 39 | * handler should depend on CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG. | 39 | * an NMI handler should depend on CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG. |
| 40 | * | ||
| 41 | * Copyright 2010,2011 Intel Corp. | ||
| 42 | * Author: Huang Ying <ying.huang@intel.com> | ||
| 43 | * | ||
| 44 | * This program is free software; you can redistribute it and/or | ||
| 45 | * modify it under the terms of the GNU General Public License version | ||
| 46 | * 2 as published by the Free Software Foundation; | ||
| 47 | * | ||
| 48 | * This program is distributed in the hope that it will be useful, | ||
| 49 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 50 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 51 | * GNU General Public License for more details. | ||
| 52 | * | ||
| 53 | * You should have received a copy of the GNU General Public License | ||
| 54 | * along with this program; if not, write to the Free Software | ||
| 55 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 40 | */ | 56 | */ |
| 41 | 57 | ||
| 58 | #include <linux/kernel.h> | ||
| 59 | #include <asm/system.h> | ||
| 60 | #include <asm/processor.h> | ||
| 61 | |||
| 42 | struct llist_head { | 62 | struct llist_head { |
| 43 | struct llist_node *first; | 63 | struct llist_node *first; |
| 44 | }; | 64 | }; |
| @@ -113,14 +133,55 @@ static inline void init_llist_head(struct llist_head *list) | |||
| 113 | * test whether the list is empty without deleting something from the | 133 | * test whether the list is empty without deleting something from the |
| 114 | * list. | 134 | * list. |
| 115 | */ | 135 | */ |
| 116 | static inline int llist_empty(const struct llist_head *head) | 136 | static inline bool llist_empty(const struct llist_head *head) |
| 117 | { | 137 | { |
| 118 | return ACCESS_ONCE(head->first) == NULL; | 138 | return ACCESS_ONCE(head->first) == NULL; |
| 119 | } | 139 | } |
| 120 | 140 | ||
| 121 | void llist_add(struct llist_node *new, struct llist_head *head); | 141 | static inline struct llist_node *llist_next(struct llist_node *node) |
| 122 | void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, | 142 | { |
| 123 | struct llist_head *head); | 143 | return node->next; |
| 124 | struct llist_node *llist_del_first(struct llist_head *head); | 144 | } |
| 125 | struct llist_node *llist_del_all(struct llist_head *head); | 145 | |
| 146 | /** | ||
| 147 | * llist_add - add a new entry | ||
| 148 | * @new: new entry to be added | ||
| 149 | * @head: the head for your lock-less list | ||
| 150 | * | ||
| 151 | * Return whether list is empty before adding. | ||
| 152 | */ | ||
| 153 | static inline bool llist_add(struct llist_node *new, struct llist_head *head) | ||
| 154 | { | ||
| 155 | struct llist_node *entry, *old_entry; | ||
| 156 | |||
| 157 | entry = head->first; | ||
| 158 | for (;;) { | ||
| 159 | old_entry = entry; | ||
| 160 | new->next = entry; | ||
| 161 | entry = cmpxchg(&head->first, old_entry, new); | ||
| 162 | if (entry == old_entry) | ||
| 163 | break; | ||
| 164 | } | ||
| 165 | |||
| 166 | return old_entry == NULL; | ||
| 167 | } | ||
| 168 | |||
| 169 | /** | ||
| 170 | * llist_del_all - delete all entries from lock-less list | ||
| 171 | * @head: the head of lock-less list to delete all entries | ||
| 172 | * | ||
| 173 | * If list is empty, return NULL, otherwise, delete all entries and | ||
| 174 | * return the pointer to the first entry. The order of entries | ||
| 175 | * deleted is from the newest to the oldest added one. | ||
| 176 | */ | ||
| 177 | static inline struct llist_node *llist_del_all(struct llist_head *head) | ||
| 178 | { | ||
| 179 | return xchg(&head->first, NULL); | ||
| 180 | } | ||
| 181 | |||
| 182 | extern bool llist_add_batch(struct llist_node *new_first, | ||
| 183 | struct llist_node *new_last, | ||
| 184 | struct llist_head *head); | ||
| 185 | extern struct llist_node *llist_del_first(struct llist_head *head); | ||
| 186 | |||
| 126 | #endif /* LLIST_H */ | 187 | #endif /* LLIST_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index ede8a6585e38..e8acce717d2a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -90,6 +90,7 @@ struct sched_param { | |||
| 90 | #include <linux/task_io_accounting.h> | 90 | #include <linux/task_io_accounting.h> |
| 91 | #include <linux/latencytop.h> | 91 | #include <linux/latencytop.h> |
| 92 | #include <linux/cred.h> | 92 | #include <linux/cred.h> |
| 93 | #include <linux/llist.h> | ||
| 93 | 94 | ||
| 94 | #include <asm/processor.h> | 95 | #include <asm/processor.h> |
| 95 | 96 | ||
| @@ -1224,7 +1225,7 @@ struct task_struct { | |||
| 1224 | unsigned int ptrace; | 1225 | unsigned int ptrace; |
| 1225 | 1226 | ||
| 1226 | #ifdef CONFIG_SMP | 1227 | #ifdef CONFIG_SMP |
| 1227 | struct task_struct *wake_entry; | 1228 | struct llist_node wake_entry; |
| 1228 | int on_cpu; | 1229 | int on_cpu; |
| 1229 | #endif | 1230 | #endif |
| 1230 | int on_rq; | 1231 | int on_rq; |
| @@ -2035,6 +2036,10 @@ static inline void sched_autogroup_fork(struct signal_struct *sig) { } | |||
| 2035 | static inline void sched_autogroup_exit(struct signal_struct *sig) { } | 2036 | static inline void sched_autogroup_exit(struct signal_struct *sig) { } |
| 2036 | #endif | 2037 | #endif |
| 2037 | 2038 | ||
| 2039 | #ifdef CONFIG_CFS_BANDWIDTH | ||
| 2040 | extern unsigned int sysctl_sched_cfs_bandwidth_slice; | ||
| 2041 | #endif | ||
| 2042 | |||
| 2038 | #ifdef CONFIG_RT_MUTEXES | 2043 | #ifdef CONFIG_RT_MUTEXES |
| 2039 | extern int rt_mutex_getprio(struct task_struct *p); | 2044 | extern int rt_mutex_getprio(struct task_struct *p); |
| 2040 | extern void rt_mutex_setprio(struct task_struct *p, int prio); | 2045 | extern void rt_mutex_setprio(struct task_struct *p, int prio); |
