Skip to content

Commit

Permalink
kthread: silence bogus section mismatch warning
Browse files Browse the repository at this point in the history
WARNING: kernel/built-in.o(.text+0x16910): Section mismatch:
reference to .init.text: (between 'kthreadd' and 'init_waitqueue_head')

comes because kernel/kthread.c:kthreadd() is not __init but calls
kthreadd_setup() which is __init. But this is ok, because kthreadd_setup()
is only ever called at init time, and then kthreadd() proceeds into its
"for (;;)" loop. We could mark kthreadd __init_refok, but kthreadd_setup()
with just one callsite and 4 lines in it (it's been that small since
10ab825) doesn't need to be a separate function at all -- so let's
just move those four lines at beginning of kthreadd() itself.

Signed-off-by: Satyam Sharma <[email protected]>
Acked-by: Randy Dunlap <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Satyam Sharma authored and Linus Torvalds committed Jul 31, 2007
1 parent bbe06f6 commit e804a4a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions kernel/kthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,23 +214,15 @@ int kthread_stop(struct task_struct *k)
}
EXPORT_SYMBOL(kthread_stop);


static noinline __init_refok void kthreadd_setup(void)
int kthreadd(void *unused)
{
struct task_struct *tsk = current;

/* Setup a clean context for our children to inherit. */
set_task_comm(tsk, "kthreadd");

ignore_signals(tsk);

set_user_nice(tsk, -5);
set_cpus_allowed(tsk, CPU_MASK_ALL);
}

int kthreadd(void *unused)
{
/* Setup a clean context for our children to inherit. */
kthreadd_setup();

current->flags |= PF_NOFREEZE;

Expand Down

0 comments on commit e804a4a

Please sign in to comment.