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
5dfb4838
Commit
5dfb4838
authored
Jul 28, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cset exclude: mingo@elte.hu|ChangeSet|20020728030719|07783
parent
3f0c2c5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
58 deletions
+11
-58
init/main.c
init/main.c
+0
-4
kernel/sched.c
kernel/sched.c
+11
-54
No files found.
init/main.c
View file @
5dfb4838
...
...
@@ -526,14 +526,10 @@ static void __init do_basic_setup(void)
static
void
do_pre_smp_initcalls
(
void
)
{
#if CONFIG_SMP
extern
int
migration_init
(
void
);
#endif
extern
int
spawn_ksoftirqd
(
void
);
#if CONFIG_SMP
migration_init
();
#endif
spawn_ksoftirqd
();
}
...
...
kernel/sched.c
View file @
5dfb4838
...
...
@@ -16,23 +16,19 @@
* by Davide Libenzi, preemptible kernel bits by Robert Love.
*/
#define __KERNEL_SYSCALLS__
#include <linux/mm.h>
#include <linux/nmi.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/unistd.h>
#include <asm/uaccess.h>
#include <linux/highmem.h>
#include <linux/security.h>
#include <linux/notifier.h>
#include <linux/smp_lock.h>
#include <asm/mmu_context.h>
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/kernel_stat.h>
#include <
asm/uaccess
.h>
#include <
asm/mmu_context
.h>
#include <linux/security.h>
#include <
linux/notifier
.h>
#include <
linux/delay
.h>
/*
* Convert user-nice values [ -20 ... 0 ... 19 ]
...
...
@@ -1961,29 +1957,6 @@ void set_cpus_allowed(task_t *p, unsigned long new_mask)
preempt_enable
();
}
/*
* The migration thread startup relies on the following property
* of set_cpus_allowed(): if the thread is not running currently
* then we can just put it into the target runqueue.
*/
DECLARE_MUTEX_LOCKED
(
migration_startup
);
typedef
struct
migration_startup_data
{
int
cpu
;
task_t
*
thread
;
}
migration_startup_t
;
static
int
migration_startup_thread
(
void
*
data
)
{
migration_startup_t
*
startup
=
data
;
wait_task_inactive
(
startup
->
thread
);
set_cpus_allowed
(
startup
->
thread
,
1UL
<<
startup
->
cpu
);
up
(
&
migration_startup
);
return
0
;
}
/*
* migration_thread - this is a highprio system thread that performs
* thread migration by 'pulling' threads into the target runqueue.
...
...
@@ -1991,19 +1964,15 @@ static int migration_startup_thread(void * data)
static
int
migration_thread
(
void
*
data
)
{
struct
sched_param
param
=
{
sched_priority
:
MAX_RT_PRIO
-
1
};
migration_startup_t
startup
;
int
cpu
=
(
long
)
data
;
runqueue_t
*
rq
;
int
ret
,
pid
;
int
ret
;
daemonize
();
sigfillset
(
&
current
->
blocked
);
set_fs
(
KERNEL_DS
);
startup
.
cpu
=
cpu
;
startup
.
thread
=
current
;
pid
=
kernel_thread
(
migration_startup_thread
,
&
startup
,
CLONE_FS
|
CLONE_FILES
|
CLONE_SIGNAL
);
set_cpus_allowed
(
current
,
1UL
<<
cpu
);
/*
* Migration can happen without a migration thread on the
...
...
@@ -2011,18 +1980,7 @@ static int migration_thread(void * data)
* runqueue and the helper thread then moves this thread
* to the target CPU - we'll wake up there.
*/
down
(
&
migration_startup
);
/* we need to waitpid() to release the helper thread */
waitpid
(
pid
,
NULL
,
__WCLONE
);
/*
* At this point the startup helper thread must have
* migrated us to the proper CPU already:
*/
if
(
smp_processor_id
()
!=
cpu
)
BUG
();
printk
(
"migration_task %d on cpu=%d
\n
"
,
cpu
,
smp_processor_id
());
ret
=
setscheduler
(
0
,
SCHED_FIFO
,
&
param
);
...
...
@@ -2087,14 +2045,13 @@ static int migration_call(struct notifier_block *nfb,
unsigned
long
action
,
void
*
hcpu
)
{
unsigned
long
cpu
=
(
unsigned
long
)
hcpu
;
switch
(
action
)
{
case
CPU_ONLINE
:
printk
(
"Starting migration thread for cpu %li
\n
"
,
cpu
);
kernel_thread
(
migration_thread
,
(
void
*
)
cpu
,
printk
(
"Starting migration thread for cpu %li
\n
"
,
(
long
)
hcpu
);
kernel_thread
(
migration_thread
,
hcpu
,
CLONE_FS
|
CLONE_FILES
|
CLONE_SIGNAL
);
while
(
!
cpu_rq
(
cpu
)
->
migration_thread
)
while
(
!
cpu_rq
(
(
long
)
h
cpu
)
->
migration_thread
)
yield
();
break
;
}
...
...
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