mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Satyam Sharma" <satyam.sharma@gmail.com>
To: "Randy Dunlap" <randy.dunlap@oracle.com>
Cc: bugme-daemon@bugzilla.kernel.org,
	lkml <linux-kernel@vger.kernel.org>,
	wbrana@gmail.com, "Sam Ravnborg" <sam@ravnborg.org>
Subject: Re: [Bug 8679] New: Section mismatch: reference to .init.text
Date: Wed, 27 Jun 2007 03:12:46 +0530	[thread overview]
Message-ID: <a781481a0706261442h198cc8a6o2be7cd15c72d58@mail.gmail.com> (raw)
In-Reply-To: <a781481a0706261432g52b0e73ep1ebcd3c099a36048@mail.gmail.com>

[ I have a sinking feeling Gmail mangled the patch yet again. So,
resending. And I'm getting myself a decent mailer ASAP. Sorry for
all the noise. ]

On 6/27/07, Satyam Sharma <satyam.sharma@gmail.com> wrote:
> On 6/27/07, Randy Dunlap <randy.dunlap@oracle.com> wrote:
> > > [...]
> > > Software Environment:
> > > gcc 3.4.6, binutils 2.17
> > >
> > > Problem Description:
> > > Warnings appeared while building kernel:
> > >
> > > WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> > > .init.text: (between 'kthreadd' and 'init_waitqueue_head')
> > [...]
> > From: Randy Dunlap <randy.dunlap@oracle.com>
> >
> > kthreadd_setup() is in an __init section, but we know that it's
> > safe to be called from kthreadd() since the latter is only called
> > at kernel init time, so mark kthreadd_setup() __init_refok so
> > that modpost won't complain about what text section it is in.
>
> Hi Randy,
>
> __init_refok is for callers, so we should actually be marking kthreadd()
> as __init_refok. But I feel kthreadd_setup() doesn't want to be a separate
> function at all. This is for 2.6.22-rc6, so kindly apply.

---

From: Satyam Sharma <satyam.sharma@gmail.com>

> > WARNING: kernel/built-in.o(.text+0x15f84): Section mismatch: reference to
> > .init.text: (between 'kthreadd' and 'init_waitqueue_head')

is 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 I feel kthreadd_setup() with
just one call site and 4 lines in it shouldn't be a separate function at
all. So let's lose it and code it explicitly in kthreadd() itself.

Signed-off-by: Satyam Sharma <satyam.sharma@gmail.com>

---

 kernel/kthread.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

---

diff -ruNp a/kernel/kthread.c b/kernel/kthread.c
--- a/kernel/kthread.c	2007-06-26 06:33:08.000000000 +0530
+++ b/kernel/kthread.c	2007-06-27 02:57:46.000000000 +0530
@@ -214,23 +214,15 @@ int kthread_stop(struct task_struct *k)
 }
 EXPORT_SYMBOL(kthread_stop);

-
-static __init 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;

      reply	other threads:[~2007-06-26 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-8679-10286@http.bugzilla.kernel.org/>
2007-06-26 19:01 ` Randy Dunlap
2007-06-26 21:32   ` Satyam Sharma
2007-06-26 21:42     ` Satyam Sharma [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a781481a0706261442h198cc8a6o2be7cd15c72d58@mail.gmail.com \
    --to=satyam.sharma@gmail.com \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=sam@ravnborg.org \
    --cc=wbrana@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®