mm, oom: introduce helper function to process threads during scan