Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269169
b: refs/heads/master
c: fa14ff4
h: refs/heads/master
i:
  269167: 1b1695b
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Oct 4, 2011
1 parent a33f384 commit 915bd0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 924f8f5af31423529cc3940cb2ae9fee736b7517
refs/heads/master: fa14ff4accfb24e59d2473f3d864d6648d80563b
3 changes: 2 additions & 1 deletion trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct sched_param {
#include <linux/task_io_accounting.h>
#include <linux/latencytop.h>
#include <linux/cred.h>
#include <linux/llist.h>

#include <asm/processor.h>

Expand Down Expand Up @@ -1225,7 +1226,7 @@ struct task_struct {
unsigned int ptrace;

#ifdef CONFIG_SMP
struct task_struct *wake_entry;
struct llist_node wake_entry;
int on_cpu;
#endif
int on_rq;
Expand Down
48 changes: 10 additions & 38 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ struct rq {
#endif

#ifdef CONFIG_SMP
struct task_struct *wake_list;
struct llist_head wake_list;
#endif
};

Expand Down Expand Up @@ -2698,42 +2698,26 @@ static int ttwu_remote(struct task_struct *p, int wake_flags)
}

#ifdef CONFIG_SMP
static void sched_ttwu_do_pending(struct task_struct *list)
static void sched_ttwu_pending(void)
{
struct rq *rq = this_rq();
struct llist_node *llist = llist_del_all(&rq->wake_list);
struct task_struct *p;

raw_spin_lock(&rq->lock);

while (list) {
struct task_struct *p = list;
list = list->wake_entry;
while (llist) {
p = llist_entry(llist, struct task_struct, wake_entry);
llist = llist_next(llist);
ttwu_do_activate(rq, p, 0);
}

raw_spin_unlock(&rq->lock);
}

#ifdef CONFIG_HOTPLUG_CPU

static void sched_ttwu_pending(void)
{
struct rq *rq = this_rq();
struct task_struct *list = xchg(&rq->wake_list, NULL);

if (!list)
return;

sched_ttwu_do_pending(list);
}

#endif /* CONFIG_HOTPLUG_CPU */

void scheduler_ipi(void)
{
struct rq *rq = this_rq();
struct task_struct *list = xchg(&rq->wake_list, NULL);

if (!list)
if (llist_empty(&this_rq()->wake_list))
return;

/*
Expand All @@ -2750,25 +2734,13 @@ void scheduler_ipi(void)
* somewhat pessimize the simple resched case.
*/
irq_enter();
sched_ttwu_do_pending(list);
sched_ttwu_pending();
irq_exit();
}

static void ttwu_queue_remote(struct task_struct *p, int cpu)
{
struct rq *rq = cpu_rq(cpu);
struct task_struct *next = rq->wake_list;

for (;;) {
struct task_struct *old = next;

p->wake_entry = next;
next = cmpxchg(&rq->wake_list, old, p);
if (next == old)
break;
}

if (!next)
if (llist_add(&p->wake_entry, &cpu_rq(cpu)->wake_list))
smp_send_reschedule(cpu);
}

Expand Down

0 comments on commit 915bd0c

Please sign in to comment.