Re: [PATCH] mm: Make copy_from_user() in migrate.c statically predictable

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: H. Peter Anvin
Date: Thursday, February 18, 2010 - 5:17 pm

On 02/18/2010 03:02 PM, Linus Torvalds wrote:

OK, I was trying to make the minimal set of changes given the late -rc
status.


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.

	-hpa
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] mm: Make copy_from_user() in migrate.c statica ..., H. Peter Anvin, (Thu Feb 18, 5:17 pm)
Re: [PATCH] mm: Make copy_from_user() in migrate.c statica ..., Christoph Lameter, (Fri Feb 19, 7:55 am)