From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: kosaki.motohiro@jp.fujitsu.com,
"H. Peter Anvin" <hpa@linux.intel.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Arjan van de Ven <arjan@linux.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@linux-foundation.org>,
Hugh Dickins <hugh.dickins@tiscali.co.uk>,
Rik van Riel <riel@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] mm: Make copy_from_user() in migrate.c statically predictable
Date: Sun, 21 Feb 2010 20:45:37 +0900 (JST) [thread overview]
Message-ID: <20100221203219.B80D.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <20100219102247.B939.A69D9226@jp.fujitsu.com>
> > On 02/18/2010 03:02 PM, Linus Torvalds wrote:
> > >
> > > Hmm. When making simplifications like this, I would really suggest you
> > > also move the declaration of the variable itself into the block where it
> > > is now used, rather than leaving it be function-wide.
> > >
> > > Yes, it's used in the final condition of the for-loop, but that whole loop
> > > is just screwy. The 'err' handling is insane. Sometimes 'err' is a return
> > > value form copy_to/from_user, and sometimes it's a errno. The two are
> > > _not_ the same thing, they don't even have the same type!
> > >
> > > And 'i' is totally useless too.
> > >
> > > So that whole loop should be rewritten.
> > >
> >
> > OK, I was trying to make the minimal set of changes given the late -rc
> > status.
> >
> > > I don't even have page migration enabled, so I haven't even compile-tested
> > > this, but wouldn't something like this work? It's smaller, gets rid of two
> > > pointless variables, and looks simpler to me. Hmm?
> >
> > The code definitely looks cleaner, and it's a much more standard
> > "chunked data loop" form. Weirdly enough, though, gcc 4.4.2 can't
> > figure out the copy_from_user() that way... despite having the same
> > min() structure as my code.
> >
> > However, if I change it to:
> >
> > chunk_nr = nr_pages;
> > if (chunk_nr > DO_PAGES_STAT_CHUNK_NR)
> > chunk_nr = DO_PAGES_STAT_CHUNK_NR;
> >
> > ... then it works!
> >
> > Overall, it looks like gcc is rather fragile with regards to its ability
> > to constant-propagate. It's probably no coincidence that chunked loops
> > is the place where we really have problems with this kind of stuff.
> >
> > Updated patch, which compile-tests for me, attached.
>
> hehe, I'm ESPer. I think you hope I do runtime-test, plz wait 12 hour :-)
sorry for the delay. I had little machine trouble.
Reviewed-and-Tested-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
next prev parent reply other threads:[~2010-02-21 11:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-18 22:43 H. Peter Anvin
2010-02-18 23:02 ` Linus Torvalds
2010-02-19 0:17 ` H. Peter Anvin
2010-02-19 1:25 ` KOSAKI Motohiro
2010-02-19 1:27 ` H. Peter Anvin
2010-02-21 11:45 ` KOSAKI Motohiro [this message]
2010-02-19 14:55 ` Christoph Lameter
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=20100221203219.B80D.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@linux.kernel.org \
--cc=cl@linux-foundation.org \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=hugh.dickins@tiscali.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=riel@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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®