Commit e804a4a4dd596d853f6d6f814fbdcf97b8efcdea

Authored by Satyam Sharma
Committed by Linus Torvalds
1 parent bbe06f6bf7

kthread: silence bogus section mismatch warning

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
10ab825bdef8df51) 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 <ssatyam@cse.iitk.ac.in>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 10 deletions Side-by-side Diff

... ... @@ -214,23 +214,15 @@
214 214 }
215 215 EXPORT_SYMBOL(kthread_stop);
216 216  
217   -
218   -static noinline __init_refok void kthreadd_setup(void)
  217 +int kthreadd(void *unused)
219 218 {
220 219 struct task_struct *tsk = current;
221 220  
  221 + /* Setup a clean context for our children to inherit. */
222 222 set_task_comm(tsk, "kthreadd");
223   -
224 223 ignore_signals(tsk);
225   -
226 224 set_user_nice(tsk, -5);
227 225 set_cpus_allowed(tsk, CPU_MASK_ALL);
228   -}
229   -
230   -int kthreadd(void *unused)
231   -{
232   - /* Setup a clean context for our children to inherit. */
233   - kthreadd_setup();
234 226  
235 227 current->flags |= PF_NOFREEZE;
236 228