Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-s…
Browse files Browse the repository at this point in the history
…ched

* git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched:
  sched: do not hurt SCHED_BATCH on wakeup
  sched: touch softlockup watchdog after idling
  sched: sysctl, proc_dointvec_minmax() expects int values for
  sched: mark rwsem functions as __sched for wchan/profiling
  sched: fix crash on ia64, introduce task_current()
  • Loading branch information
Linus Torvalds committed Dec 18, 2007
2 parents 3c615e1 + 6cbf1c1 commit 51dad80
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
5 changes: 3 additions & 2 deletions kernel/rwsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/rwsem.h>

Expand All @@ -15,7 +16,7 @@
/*
* lock for reading
*/
void down_read(struct rw_semaphore *sem)
void __sched down_read(struct rw_semaphore *sem)
{
might_sleep();
rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);
Expand All @@ -42,7 +43,7 @@ EXPORT_SYMBOL(down_read_trylock);
/*
* lock for writing
*/
void down_write(struct rw_semaphore *sem)
void __sched down_write(struct rw_semaphore *sem)
{
might_sleep();
rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);
Expand Down
18 changes: 12 additions & 6 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,15 @@ EXPORT_SYMBOL_GPL(cpu_clock);
# define finish_arch_switch(prev) do { } while (0)
#endif

static inline int task_current(struct rq *rq, struct task_struct *p)
{
return rq->curr == p;
}

#ifndef __ARCH_WANT_UNLOCKED_CTXSW
static inline int task_running(struct rq *rq, struct task_struct *p)
{
return rq->curr == p;
return task_current(rq, p);
}

static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)
Expand Down Expand Up @@ -540,7 +545,7 @@ static inline int task_running(struct rq *rq, struct task_struct *p)
#ifdef CONFIG_SMP
return p->oncpu;
#else
return rq->curr == p;
return task_current(rq, p);
#endif
}

Expand Down Expand Up @@ -663,6 +668,7 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
struct rq *rq = cpu_rq(smp_processor_id());
u64 now = sched_clock();

touch_softlockup_watchdog();
rq->idle_clock += delta_ns;
/*
* Override the previous timestamp and ignore all
Expand Down Expand Up @@ -3334,7 +3340,7 @@ unsigned long long task_sched_runtime(struct task_struct *p)

rq = task_rq_lock(p, &flags);
ns = p->se.sum_exec_runtime;
if (rq->curr == p) {
if (task_current(rq, p)) {
update_rq_clock(rq);
delta_exec = rq->clock - p->se.exec_start;
if ((s64)delta_exec > 0)
Expand Down Expand Up @@ -4021,7 +4027,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)

oldprio = p->prio;
on_rq = p->se.on_rq;
running = task_running(rq, p);
running = task_current(rq, p);
if (on_rq) {
dequeue_task(rq, p, 0);
if (running)
Expand Down Expand Up @@ -4332,7 +4338,7 @@ int sched_setscheduler(struct task_struct *p, int policy,
}
update_rq_clock(rq);
on_rq = p->se.on_rq;
running = task_running(rq, p);
running = task_current(rq, p);
if (on_rq) {
deactivate_task(rq, p, 0);
if (running)
Expand Down Expand Up @@ -7101,7 +7107,7 @@ void sched_move_task(struct task_struct *tsk)

update_rq_clock(rq);

running = task_running(rq, tsk);
running = task_current(rq, tsk);
on_rq = tsk->se.on_rq;

if (on_rq) {
Expand Down
3 changes: 1 addition & 2 deletions kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)

if (!initial) {
/* sleeps upto a single latency don't count. */
if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se) &&
task_of(se)->policy != SCHED_BATCH)
if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se))
vruntime -= sysctl_sched_latency;

/* ensure we never gain time by being placed backwards. */
Expand Down
8 changes: 4 additions & 4 deletions kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ static struct ctl_table root_table[] = {
};

#ifdef CONFIG_SCHED_DEBUG
static unsigned long min_sched_granularity_ns = 100000; /* 100 usecs */
static unsigned long max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
static unsigned long min_wakeup_granularity_ns; /* 0 usecs */
static unsigned long max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
static int min_sched_granularity_ns = 100000; /* 100 usecs */
static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
static int min_wakeup_granularity_ns; /* 0 usecs */
static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
#endif

static struct ctl_table kern_table[] = {
Expand Down
2 changes: 1 addition & 1 deletion lib/rwsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, int downgrading)
/*
* wait for a lock to be granted
*/
static struct rw_semaphore *
static struct rw_semaphore __sched *
rwsem_down_failed_common(struct rw_semaphore *sem,
struct rwsem_waiter *waiter, signed long adjustment)
{
Expand Down

0 comments on commit 51dad80

Please sign in to comment.