Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ea9c300d
Commit
ea9c300d
authored
Jan 18, 2004
by
Andrew Morton
Committed by
Linus Torvalds
Jan 18, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] can_migrate_task cleanup
From: Ingo Molnar <mingo@elte.hu> - minor can_migrate_task cleanup
parent
67006113
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
kernel/sched.c
kernel/sched.c
+11
-16
No files found.
kernel/sched.c
View file @
ea9c300d
...
...
@@ -1147,25 +1147,25 @@ static inline void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t
}
/*
* Previously:
*
* #define CAN_MIGRATE_TASK(p,rq,this_cpu) \
* ((!idle || (NS_TO_JIFFIES(now - (p)->timestamp) > \
* cache_decay_ticks)) && !task_running(rq, p) && \
* cpu_isset(this_cpu, (p)->cpus_allowed))
* can_migrate_task - may task p from runqueue rq be migrated to this_cpu?
*/
static
inline
int
can_migrate_task
(
task_t
*
tsk
,
runqueue_t
*
rq
,
int
this_cpu
,
int
idle
)
{
unsigned
long
delta
=
rq
->
timestamp_last_tick
-
tsk
->
timestamp
;
if
(
!
idle
&&
(
delta
<=
JIFFIES_TO_NS
(
cache_decay_ticks
)))
return
0
;
/*
* We do not migrate tasks that are:
* 1) running (obviously), or
* 2) cannot be migrated to this CPU due to cpus_allowed, or
* 3) are cache-hot on their current CPU.
*/
if
(
task_running
(
rq
,
tsk
))
return
0
;
if
(
!
cpu_isset
(
this_cpu
,
tsk
->
cpus_allowed
))
return
0
;
if
(
!
idle
&&
(
delta
<=
JIFFIES_TO_NS
(
cache_decay_ticks
)))
return
0
;
return
1
;
}
...
...
@@ -1227,13 +1227,6 @@ static void load_balance(runqueue_t *this_rq, int idle, cpumask_t cpumask)
skip_queue:
tmp
=
list_entry
(
curr
,
task_t
,
run_list
);
/*
* We do not migrate tasks that are:
* 1) running (obviously), or
* 2) cannot be migrated to this CPU due to cpus_allowed, or
* 3) are cache-hot on their current CPU.
*/
curr
=
curr
->
prev
;
if
(
!
can_migrate_task
(
tmp
,
busiest
,
this_cpu
,
idle
))
{
...
...
@@ -1243,6 +1236,8 @@ static void load_balance(runqueue_t *this_rq, int idle, cpumask_t cpumask)
goto
skip_bitmap
;
}
pull_task
(
busiest
,
array
,
tmp
,
this_rq
,
this_cpu
);
/* Only migrate one task if we are idle */
if
(
!
idle
&&
--
imbalance
)
{
if
(
curr
!=
head
)
goto
skip_queue
;
...
...
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