linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Satyam Sharma" <satyam.sharma@gmail.com>
To: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Paul Mundt <lethal@linux-sh.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: More __meminit annotations.
Date: Mon, 18 Jun 2007 12:58:34 +0530	[thread overview]
Message-ID: <a781481a0706180028k5d44f27eld7c2d2564c42ed63@mail.gmail.com> (raw)
In-Reply-To: <a781481a0706172357s7c473686pa41df174af01cda4@mail.gmail.com>

On 6/18/07, Satyam Sharma <satyam.sharma@gmail.com> wrote:
> Hi,
>
> On 6/18/07, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> > > On Mon, Jun 18, 2007 at 02:49:24PM +0900, Yasunori Goto wrote:
> > > > > -static inline unsigned long zone_absent_pages_in_node(int nid,
> > > > > +static inline unsigned long __meminit zone_absent_pages_in_node(int nid,
> > > > >                                           unsigned long zone_type,
> > > > >                                           unsigned long *zholes_size)
> > > > >  {
> > > >
> > > > I thought __meminit is not effective for these static functions,
> > > > because they are inlined function. So, it depends on caller's
> > > > defenition. Is it wrong?
> > > >
> > > Ah, that's possible, I hadn't considered that. It seems to be a bit more
> > > obvious what the intention is if it's annotated, especially as this is
> > > the convention that's used by the rest of mm/page_alloc.c. A bit more
> > > consistent, if nothing more.
> >
> > I'm not sure which is intended. I found some functions define both
> > __init and inline in kernel tree. And probably, some functions don't
> > do it. So, it seems there is no convention.
> >
> > I'm Okay if you prefer both defined. :-)
>
> Marking inline functions as __init (or __meminit etc) is quite insane,
> IMHO. Note that all callers of the said inline function will also have to
> be __init anyway (else modpost will barf)

Actually, modpost will _not_ complain precisely _because_ kernel
uses always_inline so a separate body for the function will never be
emitted at all. But all callers of said inline function will *still* need to
be in __init anyway, else if the said inline function itself calls some
__init function (which is likely) and the caller of the said inline function
is not __init *then* modpost will complain.

> so the said function will
> have all callsites in .init.text anyway, and hence would be inlined
> in the same section as the caller (i.e. .init.text). [Note that kernel
> uses always_inline.]
>
> The annotation may still be a readability aid (which is subjective so
> one can't really comment upon), but asking gcc to put into a separate
> specified section, a function whose body would not be emitted by gcc
> separately at all, doesn't really make much sense syntactically _or_
> semantically -- gcc might not warn, of course, perhaps it's one of those
> little things it takes care of by itself silently without complaining (like
> taking pointers to inline functions).

All this is valid, still. Perhaps sparse warns / can be made to warn about
such cases (which may not be bugs, but weird C, at least)?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-06-18  7:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-18  4:52 Paul Mundt
2007-06-18  5:49 ` Yasunori Goto
2007-06-18  5:58   ` Paul Mundt
2007-06-18  6:33     ` Yasunori Goto
2007-06-18  6:57       ` Satyam Sharma
2007-06-18  7:28         ` Satyam Sharma [this message]
2007-06-18  7:48           ` Sam Ravnborg
2007-06-18  7:45   ` Sam Ravnborg
2007-06-18 10:29     ` Satyam Sharma
2007-06-18 10:54       ` Sam Ravnborg

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=a781481a0706180028k5d44f27eld7c2d2564c42ed63@mail.gmail.com \
    --to=satyam.sharma@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sam@ravnborg.org \
    --cc=y-goto@jp.fujitsu.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