On Wed, 18 May 2016 16:15:45 +0200 Michal Hocko <mhocko@xxxxxxxxxx> wrote: > > This patch adds a counter to signal_struct for tracking how many > > TIF_MEMDIE threads are in a given thread group, and check it at > > oom_scan_process_thread() so that select_bad_process() can use > > for_each_process() rather than for_each_process_thread(). > > OK, this looks correct. Strictly speaking the patch is missing any note > on _why_ this is needed or an improvement. I would add something like > the following: > " > Although the original code was correct it was quite inefficient because > each thread group was scanned num_threads times which can be a lot > especially with processes with many threads. Even though the OOM is > extremely cold path it is always good to be as effective as possible > when we are inside rcu_read_lock() - aka unpreemptible context. > " This sounds quite rubbery to me. Lots of code calls for_each_process_thread() and presumably that isn't causing problems. We're bloating up the signal_struct to solve some problem on a rarely-called slowpath with no evidence that there is actually a problem to be solved. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>