Re: [PATCHv2 1/8] khugepaged: Add self test

From: Zi Yan
Date: Wed Apr 08 2020 - 11:54:00 EST


On 8 Apr 2020, at 10:21, Kirill A. Shutemov wrote:

> External email: Use caution opening links or attachments
>
>
> On Mon, Apr 06, 2020 at 02:50:32PM -0400, Zi Yan wrote:
>> khugepaged-58 [001] .... 9913.990380: mm_khugepaged_scan_pmd: mm=00000000283d31fc, scan_pfn=0x2ae4bd, writable=0, referenced=512, none_or_zero=0, status=no_writable_page, unmapped=0
>
> Looks like all failures due to lack of writable ptes. That's very strange
> because we write to the page on fill.
>
> You've mentioned that you run it in VM. I wounder if it can be a
> virtualizaiton artefact. I run tests under KVM and they are fine. What is
> your virtualization setup?

My qemu cmd: âqemu-system-x86_64 -kernel ~/repos/linux/arch/x86/boot/bzImage -hda ~/qemu-image/vm.qcow2 -append "root=/dev/sda1 rw console=ttyS0" -pidfile vm.pid -net user,hostfwd=tcp::11022-:22 -net nic -numa node,nodeid=0 -numa node,nodeid=1 -m 20g -smp 8 -cpu host -enable-kvm -nographicâ

QEMU version is 4.2.0 (Debian 1:4.2-3)

The patches are applied on top of commit a10c9c710f9ecea87b9f4bbb837467893b4bef01 from Linusâs tree.


In addition, I tested it again on a bare metal, then all tests passed except âCollapse with max_ptes_swap pages swapped outâ, which failed most of time but succeeded occasionally.

When it fails, the tracing info is (seems like the same PTE not writable issue):

# sudo ./trace.sh
Save THP and khugepaged settings... OK
Adjust settings... OK
Swapout 64 of 512 pages... OK
Collapse with max_ptes_swap pages swapped out.... Fail
Restore THP and khugepaged settings... OK
# tracer: nop
#
# entries-in-buffer/entries-written: 42/42 #P:48
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
khugepaged-265 [002] ...1 1007.308366: mm_collapse_huge_page_swapin: mm=000000007c6cc479, swapped_in=64, referenced=448, ret=1
khugepaged-265 [002] ...2 1007.308403: mm_collapse_huge_page_isolate: scan_pfn=0x1faa6ee, none_or_zero=0, referenced=60, writable=0, status=not_suitable_page_count
khugepaged-265 [002] ...1 1007.308404: mm_collapse_huge_page: mm=000000007c6cc479, isolated=0, status=failed
khugepaged-265 [002] ...1 1007.308405: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1fafa45, writable=1, referenced=448, none_or_zero=0, status=succeeded, unmapped=64
khugepaged-265 [002] ...1 1007.328249: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.344263: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.360263: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.376241: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.392237: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.408284: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.424302: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.440284: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.456285: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.472280: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.488282: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.504264: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.520293: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.536282: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.552278: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.568302: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.584290: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.600300: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.616292: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.632290: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.648304: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.664305: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.680289: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.696294: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.712294: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.728309: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.744291: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.760288: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.776312: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.792288: mm_khugepaged_scan_pmd: mm=000000007c6cc479, scan_pfn=0x1faa6ee, writable=0, referenced=60, none_or_zero=0, status=not_suitable_page_count, unmapped=0
khugepaged-265 [002] ...1 1007.811482: mm_khugepaged_scan_pmd: mm=000000006aaca29d, scan_pfn=0xffffffffffffffff, writable=0, referenced=0, none_or_zero=0, status=pmd_null, unmapped=0
khugepaged-265 [002] ...1 1007.811482: mm_khugepaged_scan_pmd: mm=000000006aaca29d, scan_pfn=0xffffffffffffffff, writable=0, referenced=0, none_or_zero=0, status=pmd_null, unmapped=0
khugepaged-265 [002] ...1 1007.811483: mm_khugepaged_scan_pmd: mm=000000006aaca29d, scan_pfn=0xffffffffffffffff, writable=0, referenced=0, none_or_zero=0, status=pmd_null, unmapped=0
khugepaged-265 [002] ...1 1007.811483: mm_khugepaged_scan_pmd: mm=000000006aaca29d, scan_pfn=0xffffffffffffffff, writable=0, referenced=0, none_or_zero=0, status=pmd_null, unmapped=0
khugepaged-265 [002] ...1 1007.811483: mm_khugepaged_scan_pmd: mm=000000006aaca29d, scan_pfn=0xffffffffffffffff, writable=0, referenced=0, none_or_zero=0, status=pmd_null, unmapped=0
khugepaged-265 [002] ...1 1007.811484: mm_khugepaged_scan_pmd: mm=000000006aaca29d, scan_pfn=0xffffffffffffffff, writable=0, referenced=0, none_or_zero=0, status=pmd_null, unmapped=0
khugepaged-265 [002] ...1 1007.811502: mm_khugepaged_scan_pmd: mm=000000005268d9a7, scan_pfn=0xffffffffffffffff, writable=0, referenced=0, none_or_zero=0, status=pmd_null, unmapped=0
khugepaged-265 [002] ...1 1007.811502: mm_khugepaged_scan_pmd: mm=000000005268d9a7, scan_pfn=0xffffffffffffffff, writable=0, referenced=0, none_or_zero=0, status=pmd_null, unmapped=0


â
Best Regards,
Yan Zi

Attachment: signature.asc
Description: OpenPGP digital signature