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