Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
2b56f065
Commit
2b56f065
authored
Jul 26, 2009
by
Thomas Gleixner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sched: implement wake functions for the priority boosting code
Signed-off-by:
Thomas Gleixner
<
tglx@linutronix.de
>
parent
53e9ba17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
10 deletions
+37
-10
include/linux/sched.h
include/linux/sched.h
+3
-0
kernel/sched.c
kernel/sched.c
+34
-10
No files found.
include/linux/sched.h
View file @
2b56f065
...
...
@@ -1969,6 +1969,9 @@ extern void do_timer(unsigned long ticks);
extern
int
wake_up_state
(
struct
task_struct
*
tsk
,
unsigned
int
state
);
extern
int
wake_up_process
(
struct
task_struct
*
tsk
);
extern
int
wake_up_process_mutex
(
struct
task_struct
*
tsk
);
extern
int
wake_up_process_sync
(
struct
task_struct
*
tsk
);
extern
int
wake_up_process_mutex_sync
(
struct
task_struct
*
tsk
);
extern
void
wake_up_new_task
(
struct
task_struct
*
tsk
,
unsigned
long
clone_flags
);
#ifdef CONFIG_SMP
...
...
kernel/sched.c
View file @
2b56f065
...
...
@@ -2415,7 +2415,8 @@ void task_oncpu_function_call(struct task_struct *p,
*
* returns failure only if the task is already active.
*/
static
int
try_to_wake_up
(
struct
task_struct
*
p
,
unsigned
int
state
,
int
sync
)
static
int
try_to_wake_up
(
struct
task_struct
*
p
,
unsigned
int
state
,
int
sync
,
int
mutex
)
{
int
cpu
,
orig_cpu
,
this_cpu
,
success
=
0
;
unsigned
long
flags
;
...
...
@@ -2524,7 +2525,10 @@ out_running:
trace_sched_wakeup
(
rq
,
p
,
success
);
check_preempt_curr
(
rq
,
p
,
sync
);
p
->
state
=
TASK_RUNNING
;
if
(
mutex
)
p
->
state
=
TASK_RUNNING_MUTEX
;
else
p
->
state
=
TASK_RUNNING
;
#ifdef CONFIG_SMP
if
(
p
->
sched_class
->
task_wake_up
)
p
->
sched_class
->
task_wake_up
(
rq
,
p
);
...
...
@@ -2548,13 +2552,31 @@ out:
*/
int
wake_up_process
(
struct
task_struct
*
p
)
{
return
try_to_wake_up
(
p
,
TASK_ALL
,
0
);
return
try_to_wake_up
(
p
,
TASK_ALL
,
0
,
0
);
}
EXPORT_SYMBOL
(
wake_up_process
);
int
wake_up_process_sync
(
struct
task_struct
*
p
)
{
return
try_to_wake_up
(
p
,
TASK_ALL
,
1
,
0
);
}
EXPORT_SYMBOL
(
wake_up_process_sync
);
int
wake_up_process_mutex
(
struct
task_struct
*
p
)
{
return
try_to_wake_up
(
p
,
TASK_ALL
,
0
,
1
);
}
EXPORT_SYMBOL
(
wake_up_process_mutex
);
int
wake_up_process_mutex_sync
(
struct
task_struct
*
p
)
{
return
try_to_wake_up
(
p
,
TASK_ALL
,
1
,
1
);
}
EXPORT_SYMBOL
(
wake_up_process_mutex_sync
);
int
wake_up_state
(
struct
task_struct
*
p
,
unsigned
int
state
)
{
return
try_to_wake_up
(
p
,
state
,
0
);
return
try_to_wake_up
(
p
,
state
|
TASK_RUNNING_MUTEX
,
0
,
0
);
}
/*
...
...
@@ -5358,7 +5380,8 @@ need_resched_nonpreemptible:
update_rq_clock
(
rq
);
clear_tsk_need_resched
(
prev
);
if
(
prev
->
state
&&
!
(
preempt_count
()
&
PREEMPT_ACTIVE
))
{
if
((
prev
->
state
&
~
TASK_RUNNING_MUTEX
)
&&
!
(
preempt_count
()
&
PREEMPT_ACTIVE
))
{
if
(
unlikely
(
signal_pending_state
(
prev
->
state
,
prev
)))
prev
->
state
=
TASK_RUNNING
;
else
...
...
@@ -5410,7 +5433,7 @@ need_resched:
}
EXPORT_SYMBOL
(
schedule
);
#if
def CONFIG_SMP
#if
defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_RT)
/*
* Look out! "owner" is an entirely speculative pointer
* access and not reliable.
...
...
@@ -5557,7 +5580,8 @@ asmlinkage void __sched preempt_schedule_irq(void)
int
default_wake_function
(
wait_queue_t
*
curr
,
unsigned
mode
,
int
sync
,
void
*
key
)
{
return
try_to_wake_up
(
curr
->
private
,
mode
,
sync
);
return
try_to_wake_up
(
curr
->
private
,
mode
|
TASK_RUNNING_MUTEX
,
sync
,
0
);
}
EXPORT_SYMBOL
(
default_wake_function
);
...
...
@@ -5600,7 +5624,7 @@ void __wake_up(wait_queue_head_t *q, unsigned int mode,
unsigned
long
flags
;
spin_lock_irqsave
(
&
q
->
lock
,
flags
);
__wake_up_common
(
q
,
mode
,
nr_exclusive
,
0
,
key
);
__wake_up_common
(
q
,
mode
,
nr_exclusive
,
1
,
key
);
spin_unlock_irqrestore
(
&
q
->
lock
,
flags
);
}
EXPORT_SYMBOL
(
__wake_up
);
...
...
@@ -5680,7 +5704,7 @@ void complete(struct completion *x)
spin_lock_irqsave
(
&
x
->
wait
.
lock
,
flags
);
x
->
done
++
;
__wake_up_common
(
&
x
->
wait
,
TASK_NORMAL
,
1
,
0
,
NULL
);
__wake_up_common
(
&
x
->
wait
,
TASK_NORMAL
,
1
,
1
,
NULL
);
spin_unlock_irqrestore
(
&
x
->
wait
.
lock
,
flags
);
}
EXPORT_SYMBOL
(
complete
);
...
...
@@ -5700,7 +5724,7 @@ void complete_all(struct completion *x)
spin_lock_irqsave
(
&
x
->
wait
.
lock
,
flags
);
x
->
done
+=
UINT_MAX
/
2
;
__wake_up_common
(
&
x
->
wait
,
TASK_NORMAL
,
0
,
0
,
NULL
);
__wake_up_common
(
&
x
->
wait
,
TASK_NORMAL
,
0
,
1
,
NULL
);
spin_unlock_irqrestore
(
&
x
->
wait
.
lock
,
flags
);
}
EXPORT_SYMBOL
(
complete_all
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment