The page_owner_sort tool fails to sort the page owner information.

Solution Verified - Updated -

Issue

  • The page_owner_sort tool fails to sort the page owner information (/sys/kernel/debug/page_owner) captured from RHEL-8.7 (kernel 4.18.0-425.3.1.el8 and above)
    and RHEL-9.0 (kernel 5.14.0-70.13.1.el9 and above).
Red Hat Enterprise Linux 8.7

# uname -r
4.18.0-425.3.1.el8.x86_64

# ./anon_prog 
10 GB memory filled with 0 by memset()

# cat /sys/kernel/debug/page_owner > page_owner_full.txt

# grep -v ^PFN page_owner_full.txt > page_owner.txt

# page_owner_sort page_owner.txt sorted_page_owner.txt
loaded 3491534
sorting ....
culling

# head -n 20 sorted_page_owner.txt
12 times:
Page allocated via order 0, mask 0x6082c2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 2, tgid 2 (kthreadd), ts 326107344 ns, free_ts 0 ns
 prep_new_page+0xe5/0x100
 get_page_from_freelist+0x1114/0x1360
 __alloc_pages_nodemask+0x166/0x320
 __vmalloc_node_range+0x135/0x230
 copy_process+0x8de/0x1bb0
 _do_fork+0x8b/0x340
 kernel_thread+0x25/0x30
 kthreadd+0x2a3/0x2f0
 ret_from_fork+0x35/0x40

4 times:
Page allocated via order 0, mask 0x6082c2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 2, tgid 2 (kthreadd), ts 302417615 ns, free_ts 0 ns
 prep_new_page+0xe5/0x100
 get_page_from_freelist+0x1114/0x1360
 __alloc_pages_nodemask+0x166/0x320
 __vmalloc_node_range+0x135/0x230
 copy_process+0x8de/0x1bb0
 _do_fork+0x8b/0x340
  • The page_owner_sort tool shows the expected result for the page owner information captured from RHEL-8.6 (kernel 4.18.0-372.70.1.el8_6 and below).
Red Hat Enterprise Linux 8.6 
**************************** 
# uname -r
4.18.0-372.70.1.el8_6.x86_64

# ./anon_prog 
10 GB memory filled with 0 by memset()

# cat /sys/kernel/debug/page_owner > page_owner_full.txt

# grep -v ^PFN page_owner_full.txt > page_owner.txt

# page_owner_sort page_owner.txt sorted_page_owner.txt
loaded 49461
sorting ....
culling

# head -n 17 sorted_page_owner.txt
2621440 times:
Page allocated via order 0, mask 0x6200ca(GFP_HIGHUSER_MOVABLE)
 prep_new_page+0xe5/0x100
 get_page_from_freelist+0x1114/0x1360
 __alloc_pages_nodemask+0x166/0x320
 alloc_pages_vma+0x74/0x1d0
 shmem_alloc_page+0x47/0x90
 shmem_alloc_and_acct_page+0x76/0x1c0
 shmem_getpage_gfp+0x16f/0x8a0
 shmem_fault+0x78/0x220
 __do_fault+0x38/0xc0
 handle_pte_fault+0x491/0x880
 __handle_mm_fault+0x453/0x6c0
 handle_mm_fault+0xc1/0x1e0
 do_user_addr_fault+0x1b9/0x450
 do_page_fault+0x37/0x130
 page_fault+0x1e/0x30

- Page allocated via order 0
- Memory allocation times is 2621440

# bc -q
scale=2
2621440*4/2^20
10.00 (GiB)

Environment

  • Red Hat Enterprise Linux 8.7
    • kernel-4.18.0-425.3.1.el8 and above
  • Red Hat Enterprise Linux 9.0
    • kernel-5.14.0-70.13.1.el9 and above
  • kernel-tools

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content