From: Andrew Morton <akpm@linux-foundation.org>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
minchan.kim@gmail.com, kamezawa.hiroyu@jp.fujitsu.com,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] mm: add replace_page_cache_page() function
Date: Tue, 18 Jan 2011 16:41:33 -0800 [thread overview]
Message-ID: <20110118164133.9fecc2c6.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110119092733.4927f935.nishimura@mxp.nes.nec.co.jp>
On Wed, 19 Jan 2011 09:27:33 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
> On Tue, 18 Jan 2011 15:28:44 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Tue, 18 Jan 2011 12:18:11 +0100
> > Miklos Szeredi <miklos@szeredi.hu> wrote:
> >
> > > +int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
> > > +{
> > > + int error;
> > > + struct mem_cgroup *memcg = NULL;
> >
> > I'm suspecting that the unneeded initialisation was added to suppress a
> > warning?
> >
> No.
> It's necessary for mem_cgroup_{prepare|end}_migration().
> mem_cgroup_prepare_migration() will return without doing anything in
> "if (mem_cgroup_disabled()" case(iow, "memcg" is not overwritten),
> but mem_cgroup_end_migration() depends on the value of "memcg" to decide
> whether prepare_migration has succeeded or not.
> This may not be a good implementation,
It's a *surprising* implementation, in the context of kernel
conventions. At least, it fooled me :)
Which makes it a not-good implementation, really. Also, it's
undocumented.
> but IMHO I'd like to to initialize
> valuable before using it in general.
mem_cgroup_prepare_migration() performs the initialisation! We do this
in many places - it's the basic "function with more than one return
value" mechanism.
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
minchan.kim@gmail.com, kamezawa.hiroyu@jp.fujitsu.com,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] mm: add replace_page_cache_page() function
Date: Tue, 18 Jan 2011 16:41:33 -0800 [thread overview]
Message-ID: <20110118164133.9fecc2c6.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110119092733.4927f935.nishimura@mxp.nes.nec.co.jp>
On Wed, 19 Jan 2011 09:27:33 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
> On Tue, 18 Jan 2011 15:28:44 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Tue, 18 Jan 2011 12:18:11 +0100
> > Miklos Szeredi <miklos@szeredi.hu> wrote:
> >
> > > +int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
> > > +{
> > > + int error;
> > > + struct mem_cgroup *memcg = NULL;
> >
> > I'm suspecting that the unneeded initialisation was added to suppress a
> > warning?
> >
> No.
> It's necessary for mem_cgroup_{prepare|end}_migration().
> mem_cgroup_prepare_migration() will return without doing anything in
> "if (mem_cgroup_disabled()" case(iow, "memcg" is not overwritten),
> but mem_cgroup_end_migration() depends on the value of "memcg" to decide
> whether prepare_migration has succeeded or not.
> This may not be a good implementation,
It's a *surprising* implementation, in the context of kernel
conventions. At least, it fooled me :)
Which makes it a not-good implementation, really. Also, it's
undocumented.
> but IMHO I'd like to to initialize
> valuable before using it in general.
mem_cgroup_prepare_migration() performs the initialisation! We do this
in many places - it's the basic "function with more than one return
value" mechanism.
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-01-19 0:42 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-18 11:18 [PATCH v4] mm: add replace_page_cache_page() function Miklos Szeredi
2011-01-18 11:18 ` Miklos Szeredi
2011-01-18 23:28 ` Andrew Morton
2011-01-18 23:28 ` Andrew Morton
2011-01-19 0:27 ` Daisuke Nishimura
2011-01-19 0:27 ` Daisuke Nishimura
2011-01-19 0:41 ` Andrew Morton [this message]
2011-01-19 0:41 ` Andrew Morton
2011-01-19 0:48 ` KAMEZAWA Hiroyuki
2011-01-19 0:48 ` KAMEZAWA Hiroyuki
2011-01-19 1:11 ` nishimura
2011-01-19 1:11 ` nishimura
2011-01-19 1:23 ` KAMEZAWA Hiroyuki
2011-01-19 1:23 ` KAMEZAWA Hiroyuki
2011-01-21 5:52 ` Daisuke Nishimura
2011-01-21 5:52 ` Daisuke Nishimura
2011-01-21 6:17 ` KAMEZAWA Hiroyuki
2011-01-21 6:17 ` KAMEZAWA Hiroyuki
2011-01-19 0:33 ` KAMEZAWA Hiroyuki
2011-01-19 0:33 ` KAMEZAWA Hiroyuki
2011-01-19 1:24 ` Minchan Kim
2011-01-19 1:24 ` Minchan Kim
2011-01-19 1:48 ` Andrew Morton
2011-01-19 1:48 ` Andrew Morton
2011-01-19 2:17 ` Minchan Kim
2011-01-19 2:17 ` Minchan Kim
2011-09-08 23:52 ` Andrew Morton
2011-09-08 23:52 ` Andrew Morton
2011-09-08 23:52 ` Andrew Morton
2011-09-09 1:43 ` KAMEZAWA Hiroyuki
2011-09-09 1:43 ` KAMEZAWA Hiroyuki
2011-01-19 1:17 ` Minchan Kim
2011-01-19 1:17 ` Minchan Kim
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=20110118164133.9fecc2c6.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=miklos@szeredi.hu \
--cc=minchan.kim@gmail.com \
--cc=nishimura@mxp.nes.nec.co.jp \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.