Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 65059
b: refs/heads/master
c: 1799e35
h: refs/heads/master
i:
  65057: 5f065d2
  65055: ffafd8d
v: v3
  • Loading branch information
Ingo Molnar committed Sep 19, 2007
1 parent c53a546 commit 39747eb
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 13 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: 31e879309474d1666d645b96de99d0b682fa055f
refs/heads/master: 1799e35d5baab6e06168b46cc78b968e728ea3d1
1 change: 1 addition & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,7 @@ extern unsigned int sysctl_sched_wakeup_granularity;
extern unsigned int sysctl_sched_batch_wakeup_granularity;
extern unsigned int sysctl_sched_stat_granularity;
extern unsigned int sysctl_sched_runtime_limit;
extern unsigned int sysctl_sched_compat_yield;
extern unsigned int sysctl_sched_child_runs_first;
extern unsigned int sysctl_sched_features;

Expand Down
5 changes: 1 addition & 4 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -4550,10 +4550,7 @@ asmlinkage long sys_sched_yield(void)
struct rq *rq = this_rq_lock();

schedstat_inc(rq, yld_cnt);
if (unlikely(rq->nr_running == 1))
schedstat_inc(rq, yld_act_empty);
else
current->sched_class->yield_task(rq, current);
current->sched_class->yield_task(rq, current);

/*
* Since we are going to call schedule() anyway, there's
Expand Down
63 changes: 57 additions & 6 deletions trunk/kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ unsigned int sysctl_sched_latency __read_mostly = 20000000ULL;
*/
unsigned int sysctl_sched_min_granularity __read_mostly = 2000000ULL;

/*
* sys_sched_yield() compat mode
*
* This option switches the agressive yield implementation of the
* old scheduler back on.
*/
unsigned int __read_mostly sysctl_sched_compat_yield;

/*
* SCHED_BATCH wake-up granularity.
* (default: 25 msec, units: nanoseconds)
Expand Down Expand Up @@ -897,19 +905,62 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep)
}

/*
* sched_yield() support is very simple - we dequeue and enqueue
* sched_yield() support is very simple - we dequeue and enqueue.
*
* If compat_yield is turned on then we requeue to the end of the tree.
*/
static void yield_task_fair(struct rq *rq, struct task_struct *p)
{
struct cfs_rq *cfs_rq = task_cfs_rq(p);
struct rb_node **link = &cfs_rq->tasks_timeline.rb_node;
struct sched_entity *rightmost, *se = &p->se;
struct rb_node *parent;

__update_rq_clock(rq);
/*
* Dequeue and enqueue the task to update its
* position within the tree:
* Are we the only task in the tree?
*/
if (unlikely(cfs_rq->nr_running == 1))
return;

if (likely(!sysctl_sched_compat_yield)) {
__update_rq_clock(rq);
/*
* Dequeue and enqueue the task to update its
* position within the tree:
*/
dequeue_entity(cfs_rq, &p->se, 0);
enqueue_entity(cfs_rq, &p->se, 0);

return;
}
/*
* Find the rightmost entry in the rbtree:
*/
dequeue_entity(cfs_rq, &p->se, 0);
enqueue_entity(cfs_rq, &p->se, 0);
do {
parent = *link;
link = &parent->rb_right;
} while (*link);

rightmost = rb_entry(parent, struct sched_entity, run_node);
/*
* Already in the rightmost position?
*/
if (unlikely(rightmost == se))
return;

/*
* Minimally necessary key value to be last in the tree:
*/
se->fair_key = rightmost->fair_key + 1;

if (cfs_rq->rb_leftmost == &se->run_node)
cfs_rq->rb_leftmost = rb_next(&se->run_node);
/*
* Relink the task to the rightmost position:
*/
rb_erase(&se->run_node, &cfs_rq->tasks_timeline);
rb_link_node(&se->run_node, parent, link);
rb_insert_color(&se->run_node, &cfs_rq->tasks_timeline);
}

/*
Expand Down
8 changes: 8 additions & 0 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,14 @@ static ctl_table kern_table[] = {
.proc_handler = &proc_dointvec,
},
#endif
{
.ctl_name = CTL_UNNUMBERED,
.procname = "sched_compat_yield",
.data = &sysctl_sched_compat_yield,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
#ifdef CONFIG_PROVE_LOCKING
{
.ctl_name = CTL_UNNUMBERED,
Expand Down
2 changes: 0 additions & 2 deletions trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ static inline int inode_doinit(struct inode *inode)
}

enum {
Opt_error = -1,
Opt_context = 1,
Opt_fscontext = 2,
Opt_defcontext = 4,
Expand All @@ -328,7 +327,6 @@ static match_table_t tokens = {
{Opt_fscontext, "fscontext=%s"},
{Opt_defcontext, "defcontext=%s"},
{Opt_rootcontext, "rootcontext=%s"},
{Opt_error, NULL},
};

#define SEL_MOUNT_FAIL_MSG "SELinux: duplicate or incompatible mount options\n"
Expand Down

0 comments on commit 39747eb

Please sign in to comment.