problem with rss in zap_page_range

Bill Hawes (whawes@star.net)
Fri, 15 Aug 1997 16:48:16 -0400


I noticed this a while back in both 2.0.xx and 2.1.xx. zap_page_range()
is called with a mm_struct argument, but at the lowest level in
free_pte() the released pages decrement current->mm->rss. This is OK in
most cases, but if zap_page_range() is being used to clean up a failed
fork (from exit_mm), the mm_struct is from a task that never started.
Thus it's not appropriate to modify current->mm in this case.

The straightforward way to fix this seems to be to return a value from
free_pte() indicating the page was freed, and then sum these up the
chain, to be credited to the correct mm in zap_page_range().

Comments? Does this seem reasonable?

Regards,
Bill