Repository navigation
Commit 9845cbb
mm, thp: fix infinite loop on memcg OOM
Masayoshi Mizuma reported a bug with the hang of an application under
the memcg limit. It happens on write-protection fault to huge zero page
If we successfully allocate a huge page to replace zero page but hit the
memcg limit we need to split the zero page with split_huge_page_pmd()
and fallback to small pages.
The other part of the problem is that VM_FAULT_OOM has special meaning
in do_huge_pmd_wp_page() context. __handle_mm_fault() expects the page
to be split if it sees VM_FAULT_OOM and it will will retry page fault
handling. This causes an infinite loop if the page was not split.
do_huge_pmd_wp_zero_page_fallback() can return VM_FAULT_OOM if it failed
to allocate one small page, so fallback to small pages will not help.
The solution for this part is to replace VM_FAULT_OOM with
VM_FAULT_FALLBACK is fallback required.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent 0141288 commit 9845cbb
2 files changed
Lines changed: 9 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1166 | 1166 | | |
1167 | 1167 | | |
1168 | 1168 | | |
1169 | | - | |
| 1169 | + | |
1170 | 1170 | | |
| 1171 | + | |
| 1172 | + | |
1171 | 1173 | | |
1172 | 1174 | | |
1173 | 1175 | | |
| |||
1179 | 1181 | | |
1180 | 1182 | | |
1181 | 1183 | | |
1182 | | - | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
1183 | 1187 | | |
1184 | | - | |
1185 | 1188 | | |
1186 | 1189 | | |
1187 | 1190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3704 | 3704 | | |
3705 | 3705 | | |
3706 | 3706 | | |
3707 | | - | |
3708 | 3707 | | |
3709 | 3708 | | |
3710 | 3709 | | |
| |||
3742 | 3741 | | |
3743 | 3742 | | |
3744 | 3743 | | |
3745 | | - | |
3746 | | - | |
3747 | | - | |
3748 | | - | |
3749 | | - | |
3750 | | - | |
3751 | | - | |
3752 | | - | |
| 3744 | + | |
| 3745 | + | |
3753 | 3746 | | |
3754 | 3747 | | |
3755 | 3748 | | |
| 3749 | + | |
3756 | 3750 | | |
3757 | | - | |
3758 | | - | |
3759 | 3751 | | |
3760 | 3752 | | |
3761 | 3753 | | |
| |||
0 commit comments