Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: delete unused MMF_OOM_VICTIM flag

With the last usage of MMF_OOM_VICTIM in exit_mmap gone, this flag is now
unused and can be removed.

[akpm@linux-foundation.org: remove comment about now-removed mm_is_oom_victim()]
Link: https://lkml.kernel.org/r/20220531223100.510392-2-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: "Kirill A . Shutemov" <kirill@shutemov.name>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Christian Brauner (Microsoft) <brauner@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Suren Baghdasaryan and committed by
Andrew Morton
b3541d91 bf3980c8

+5 -18
-9
include/linux/oom.h
··· 78 78 } 79 79 80 80 /* 81 - * Use this helper if tsk->mm != mm and the victim mm needs a special 82 - * handling. This is guaranteed to stay true after once set. 83 - */ 84 - static inline bool mm_is_oom_victim(struct mm_struct *mm) 85 - { 86 - return test_bit(MMF_OOM_VICTIM, &mm->flags); 87 - } 88 - 89 - /* 90 81 * Checks whether a page fault on the given mm is still reliable. 91 82 * This is no longer true if the oom reaper started to reap the 92 83 * address space which is reflected by MMF_UNSTABLE flag set in
+3 -4
include/linux/sched/coredump.h
··· 71 71 #define MMF_UNSTABLE 22 /* mm is unstable for copy_from_user */ 72 72 #define MMF_HUGE_ZERO_PAGE 23 /* mm has ever used the global huge zero page */ 73 73 #define MMF_DISABLE_THP 24 /* disable THP for all VMAs */ 74 - #define MMF_OOM_VICTIM 25 /* mm is the oom victim */ 75 - #define MMF_OOM_REAP_QUEUED 26 /* mm was queued for oom_reaper */ 76 - #define MMF_MULTIPROCESS 27 /* mm is shared between processes */ 74 + #define MMF_OOM_REAP_QUEUED 25 /* mm was queued for oom_reaper */ 75 + #define MMF_MULTIPROCESS 26 /* mm is shared between processes */ 77 76 /* 78 77 * MMF_HAS_PINNED: Whether this mm has pinned any pages. This can be either 79 78 * replaced in the future by mm.pinned_vm when it becomes stable, or grow into ··· 80 81 * pinned pages were unpinned later on, we'll still keep this bit set for the 81 82 * lifecycle of this mm, just for simplicity. 82 83 */ 83 - #define MMF_HAS_PINNED 28 /* FOLL_PIN has run, never cleared */ 84 + #define MMF_HAS_PINNED 27 /* FOLL_PIN has run, never cleared */ 84 85 #define MMF_DISABLE_THP_MASK (1 << MMF_DISABLE_THP) 85 86 86 87 #define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\
+1 -2
mm/mmap.c
··· 3105 3105 3106 3106 /* 3107 3107 * Set MMF_OOM_SKIP to hide this task from the oom killer/reaper 3108 - * because the memory has been already freed. Do not bother checking 3109 - * mm_is_oom_victim because setting a bit unconditionally is cheaper. 3108 + * because the memory has been already freed. 3110 3109 */ 3111 3110 set_bit(MMF_OOM_SKIP, &mm->flags); 3112 3111 mmap_write_lock(mm);
+1 -3
mm/oom_kill.c
··· 765 765 return; 766 766 767 767 /* oom_mm is bound to the signal struct life time. */ 768 - if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm)) { 768 + if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm)) 769 769 mmgrab(tsk->signal->oom_mm); 770 - set_bit(MMF_OOM_VICTIM, &mm->flags); 771 - } 772 770 773 771 /* 774 772 * Make sure that the task is woken up from uninterruptible sleep