ask for your help about a patch (commit: 9845cbb)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · gux.fnst
Hi Kirill,
Hi Xing,
Please always CC to mailing list for upstream-related questions. I've added linux-mm@ to CC.
Quoted 33 lines
Currently I'm doing some kernel test work, including that reproducing some existing kernel bugs. Here I may need your some help.
On 2014-02-25, you committed a patch (commit: 9845cbb) about thp.
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 withsplit_huge_page_pmd()and fallback to small pages.The other part of the problem is that
VM_FAULT_OOMhas special meaning indo_huge_pmd_wp_page()context.__handle_mm_fault()expects the page to be split if
it seesVM_FAULT_OOMand 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 returnVM_FAULT_OOMif 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_OOMwithVM_FAULT_FALLBACKis
fallback required.
---------------------------------------------------------------------------------------------------------------------------
Quoted 4 lines
It is a little difficult to reproduce this problem fixed by this patch for me. Could you give me some
hint about how to do this - a??allocate a huge page to replace zero page but hit the memcg limit"?
I used this script:
#!/bin/sh -efu
set -efux
mount -t cgroup none /sys/fs/cgroup
mkdir /sys/fs/cgroup/test
echo "10M" > /sys/fs/cgroup/test/memory.limit_in_bytes echo "10M" > /sys/fs/cgroup/test/memory.memsw.limit_in_bytes
echo $$ > /sys/fs/cgroup/test/tasks
/host/home/kas/var/mmaptest_zero
echo ok
Where /host/home/kas/var/mmaptest_zero is:
#include <assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#define MB (1024 * 1024)
#define SIZE (256 * MB)
int main(int argc, char **argv)
{
int i;
char *p;
posix_memalign((void **)&p, 2 * MB, SIZE);
printf("p: %p\n", p);
fork();
for (i = 0; i < SIZE; i += 4096)
assert(p[i] == 0);
for (i = 0; i < SIZE; i += 4096)
p[i] = 1;
pause();
return 0;
}Without the patch it hangs, but should trigger OOM.
Signature · 7 lines
Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Kirill A. Shutemov
Quoted 1 line · gux.fnst
Hi Kirill,
Hi Xing,
Please always CC to mailing list for upstream-related questions. I've added linux-mm@ to CC.
OK, got it.
Quoted 54 lines
VM_FAULT_FALLBACKis
fallback required.
---------------------------------------------------------------------------------------------------------------------------It is a little difficult to reproduce this problem fixed by this patch for me. Could you give me some
hint about how to do this - “allocate a huge page to replace zero page but hit the memcg limit"?
I used this script:#!/bin/sh -efu
set -efux
mount -t cgroup none
/sys/fs/cgroup
mkdir/sys/fs/cgroup/test
echo "10M" >/sys/fs/cgroup/test/memory.limit_in_bytesecho "10M" >/sys/fs/cgroup/test/memory.memsw.limit_in_bytesecho $$ >
/sys/fs/cgroup/test/tasks
/host/home/kas/var/mmaptest_zero
echo okWhere /host/home/kas/var/mmaptest_zero is:
#include <
assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>#define MB (1024 * 1024)
#define SIZE (256 * MB)int
main(int argc, char **argv){ int i; char *p; posix_memalign((void **)&p, 2 * MB, SIZE); printf("p: %p\n", p); fork(); for (i = 0; i < SIZE; i += 4096) assert(p[i] == 0); for (i = 0; i < SIZE; i += 4096) p[i] = 1; pause(); return 0; }
Quoted 2 lines
Without the patch it hangs, but should trigger OOM.
Thank you very much.
Regards,
Xing Gu
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>