On Fri, Nov 19, 2004 at 11:59:03AM -0800, Linus Torvalds wrote:
You could also make "rss" be a _signed_ integer per-thread.
When unmapping a page, you decrement one of the threads that shares the mm (doesn't matter which - which is why the per-thread rss may go negative), and when mapping a page you increment it.
Then, anybody who actually wants a global rss can just iterate over
threads and add it all up. If you do it under the mmap_sem, it's stable,
and if you do it outside the mmap_sem it's imprecise but stable in the
long term (ie errors never _accumulate_, like the non-atomic case will do).
Does anybody care enough? Maybe, maybe not. It certainly sounds a hell of a lot better than the periodic scan.
Unprivileged triggers for full-tasklist scans are NMI oops material.