• David Rientjes's avatar
    oom: avoid unnecessary mm locking and scanning for OOM_DISABLE · 4d8b9135
    David Rientjes authored
    This moves the check for OOM_DISABLE to the badness heuristic so it is
    only necessary to hold task_lock() once.  If the mm is OOM_DISABLE, the
    score is 0, which is also correctly exported via /proc/pid/oom_score.
    This requires that tasks with badness scores of 0 are prohibited from
    being oom killed, which makes sense since they would not allow for future
    memory freeing anyway.
    
    Since the oom_adj value is a characteristic of an mm and not a task, it is
    no longer necessary to check the oom_adj value for threads sharing the
    same memory (except when simply issuing SIGKILLs for threads in other
    thread groups).
    
    Cc: Nick Piggin <npiggin@suse.de>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Mel Gorman <mel@csn.ul.ie>
    Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    4d8b9135
oom_kill.c 16.1 KB