[ANNOUNCE] crash version 7.1.9 is available
by Dave Anderson
Download from: http://people.redhat.com/anderson
or
https://github.com/crash-utility/crash/releases
The github master branch serves as a development branch that will contain
all patches that are queued for the next release:
$ git clone git://github.com/crash-utility/crash.git
Changelog:
- Fixes to address three gcc-7.0.1 compiler warnings that are generated
when building with "make warn". The warning types are "[-Wnonnull]"
in filesys.c, and "[-Wformat-overflow=]" in kernel.c and cmdline.c.
(anderson(a)redhat.com)
- Fix for the PPC64 "mach -o" option to update the OPAL console buffer
size from 256K to 1MB, based upon the latest skiboot firmware source.
(ankit(a)linux.vnet.ibm.com)
- Fix for the "mod -[sS]" option to prevent the erroneous reassignment
of one or more symbol values of a kernel module. Without the patch,
when loading a kernel module, a message may indicate "mod: <module>:
last symbol: <symbol> is not _MODULE_END_<module>?" may be displayed,
and one or more symbols may be reassigned an incorrect symbol value.
If none of the erroneous symbol value reassignments are beyond the
end of the module's address space, then there will be no message.
(anderson(a)redhat.com)
- Linux 4.10 commit 401721ecd1dcb0a428aa5d6832ee05ffbdbffbbe finally
exports the x86_64 "phys_base" value in the VMCOREINFO note, so
utilize it whenever it exists.
(anderson(a)redhat.com)
- Implemented a new "log -a" option that dumps the audit logs remaining
in kernel audit buffers that have not been copied out to the
user-space audit daemon.
(d.hatayama(a)jp.fujitsu.com)
- Fix for the "kmem <address>" option and the "search" command
in x86_64 kernels that contain, or have backports of, kernel commit
7c1da8d0d046174a4188b5729d7579abf3d29427, titled "crypto: sha - SHA1
transform x86_64 AVX2", which introduced an "_end" text symbol.
Without the patch, if a base kernel symbol address that is larger
than the "_end" text symbol is passed to "kmem <address>", its
symbol/filename information will not be displayed. Also, when the
"search" command scans the __START_KERNEL_map region that contains
kernel text and static data, the search will be truncated to stop at
the "_end" text symbol address.
(anderson(a)redhat.com)
- Enhancement for the determination of the ARM64 "kimage_voffset" value
in Linux 4.6 and later kernels if an ELF format dumpfile does not
contain its value in a VMCOREINFO note, or when running against
live systems using /dev/mem, /proc/kcore, or an older version of
/dev/crash.
(liyueyi(a)live.com)
- Optimization of the "kmem -f <address>" and "kmem <r;address>" options
to signficantly reduce the amount of time to complete the buddy
allocator free-list scan for the target address. On very large
memory systems, the patch may reduce the time spent by several orders
of magnitude.
(anderson(a)redhat.com)
- Fix for a compilation error if glibc-2.25 or later has been installed
on the host build machine. Without the patch, the build fails with
the error message "amd64-linux-nat.c:496:1: error: conflicting types
for 'ps_get_thread_area'".
(anderson(a)redhat.com)
- Fix for the "list -[hH]" options if a list_head.next pointer is
encountered that contains an invalid NULL pointer. Without the
patch, the "list -[hH]" options would complete/continue as if the
NULL were a legitimate end-of-list indicator, and no error would be
reported.
(rabin.vincent(a)axis.com)
- Provide basic Huge Page usage as part of "kmem -i" output, showing
the total amount of memory allocated for huge pages, and the amount
of the total that is free.
(atomlin(a)redhat.com)
- Fix for the determination of the x86_64 "phys_base" value when it is
not passed in the VMCOREINFO data of ELF vmcores. Without the patch,
it is possible that the base address of the vmalloc region is unknown
and initialized to an incorrect default address during the very early
stages of initialization, which causes the parsing of the PT_LOAD
segments for the START_KERNEL_map region to fail.
(anderson(a)redhat.com)
- Fix for the "dis" command to detect duplicate symbols in the case
of a "symbol+offset" argument where the duplicates are contiguous
in the symbol list. In addition, reject "symbol+offset" arguments
if the resultant address goes beyond the end of the function.
(anderson(a)redhat.com)
- Fix for the "set scope" option if the kernel was configured with
CONFIG_RANDOMIZE_BASE. Without the patch, the command fails with
the message "set: gdb cannot find text block for address: <symbol>".
This also affects extension modules that call gdb_set_crash_scope()
when running with KASLR kernels.
(anderson(a)redhat.com)
- Fix for the extensions/trace.c extension module to account for
Linux 4.7 kernel commit 9b94a8fba501f38368aef6ac1b30e7335252a220,
which changed the ring_buffer_per_cpu.nr_pages member from an int
to a long. Without the patch, the trace.so extension module fails
to load on big-endian machines, indicating "extend: Num of pages
is less than 0".
(feij.fnst(a)cn.fujitsu.com)
- Fix for the extensions/trace.c extension module when running on
the ppc64 architecture. Without the patch, the trace.so extension
module fails to load, indicating "extend: invalid text address:
ring_buffer_read". On the ppc64 architecture, the text symbol
is ".ring_buffer_read".
(anderson(a)redhat.com)
- Fix for the ARM64 "bt" command. Without the patch, the backtrace of
a non-panicking active task generates a segmentation violation when
analyzing Android 4.4-based dumpfiles.
(zhizhouzhang(a)asrmicro.com)
7 years, 8 months
[BUG?] failed to execute bt -a for arm64
by Zhi-zhou Zhang
Hi All,
I try to use `bt -a' for arm64 platform, then Segmentation fault
happened. My crash is built from source code hosted on github. And my
kernel version is 4.4.35.
I tried to use gdb to examine this problem, Some information is shown
as below:
(gdb) bt
#0 arm64_is_kernel_exception_frame (bt=bt@entry=0x7ffeba6577e0, stkptr=stkptr@entry=18446743803091823872) at arm64.c:1504
#1 0x00000000004fbda8 in arm64_back_trace_cmd (bt=0x7ffeba6577e0) at arm64.c:2259
#2 0x00000000004d415c in back_trace (bt=bt@entry=0x7ffeba6577e0) at kernel.c:3063
#3 0x00000000004dee87 in cmd_bt () at kernel.c:2701
[...]
(gdb) p/x stkptr
$14 = 0xffffffc0fded2d00
(gdb) p/x bt->stackbase
$15 = 0xffffff8008dcc000
As it is, (stkptr - bt->stackbase) is too large. It lead
bt->stackbuf[(ulong)(STACK_OFFSET_TYPE(stkptr))] index out of bounds.
This stack belongs to swapper/0. I'm not sure whether it is a BUG.
Could anyone give me some advise to solve this problem? Thank you!
7 years, 8 months
crash for live system fails to load - Ubuntu 16.10
by Kaiwan N Billimoria
Hi,
I've been using crash for a while..
Strangely, on Ubuntu (and Lubuntu) 16.10, I face the issue described below:
$ cat /etc/issue
Ubuntu 16.10 \n \l
$ uname -r
4.8.0-46-generic
$ cat /proc/version
Linux version 4.8.0-46-generic (buildd@lcy01-16) (gcc version 6.2.0
20161005 (Ubuntu 6.2.0-5ubuntu12) ) #49-Ubuntu SMP Fri Mar 31 13:57:14
UTC 2017
$ cat /proc/version_signature
Ubuntu 4.8.0-46.49-generic 4.8.17
$
So I download the dbgsym package for this kernel as:
$ wget http://ddebs.ubuntu.com/pool/main/l/linux/linux-image-4.8.0-46-generic-db...
...
Then extract the vmlinux image from the package.
$ ls -l /usr/lib/debug/boot/vmlinux-4.8.0-46-generic
-rw-r--r-- 1 root root 509M Mar 31 12:43
/usr/lib/debug/boot/vmlinux-4.8.0-46-generic
$
Run crash for 'live system':
$ sudo crash /usr/lib/debug/boot/vmlinux-4.8.0-46-generic /proc/kcore
/boot/System.map-4.8.0-46-generic
[sudo] password for kaiwan:
crash 7.1.5
Copyright (C) 2002-2016 Red Hat, Inc.
This GDB was configured as "x86_64-unknown-linux-gnu"...
--snip--
crash: seek error: kernel virtual address: ffffffff81f5dcc0 type: "possible"
WARNING: cannot read cpu_possible_map
crash: seek error: kernel virtual address: ffffffff81f5dc40 type: "present"
WARNING: cannot read cpu_present_map
crash: seek error: kernel virtual address: ffffffff81f5dc80 type: "online"
WARNING: cannot read cpu_online_map
crash: seek error: kernel virtual address: ffffffff81f5dc00 type: "active"
WARNING: cannot read cpu_active_map
crash: seek error: kernel virtual address: ffffffff81e2a070 type: "pv_init_ops"
crash: seek error: kernel virtual address: ffffffff82167130 type:
"shadow_timekeeper xtime_sec"
crash: seek error: kernel virtual address: ffffffff81e0d304 type: "init_uts_ns"
crash: /boot/System.map-4.8.0-46-generic and /proc/kcore do not match!
Usage:
crash [OPTION]... NAMELIST MEMORY-IMAGE[@ADDRESS] (dumpfile form)
crash [OPTION]... [NAMELIST] (live system form)
Enter "crash -h" for details.
$
It _does_ load up with the --minimal switch, but of course I'd like to
run it with full capabilities.
FYI, output with debug ON:
$ sudo crash -d5 /usr/lib/debug/boot/vmlinux-4.8.0-46-generic
/proc/kcore /boot/System.map-4.8.0-46-generic
crash 7.1.5
Copyright (C) 2002-2016 Red Hat, Inc.
--snip--
get_live_memory_source: /proc/kcore
proc_kcore_data:
flags: 0 (KCORE_LOCAL|KCORE_ELF64)
segments: 17
elf_header: 55f59ded06e0
elf64: 55f59ded06e0
load64: 55f59ded0758
elf32: 0
load32: 0
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 7fffff602000
p_vaddr: ffffffffff600000
p_paddr: 0
p_filesz: 1000
p_memsz: 1000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 7fff9da02000
p_vaddr: ffffffff9da00000
p_paddr: 0
p_filesz: 1268000
p_memsz: 1268000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 2922c0002000
p_vaddr: ffffa922c0000000
p_paddr: 0
p_filesz: 1fffffffffff
p_memsz: 1fffffffffff
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 7fffc0002000
p_vaddr: ffffffffc0000000
p_paddr: 0
p_filesz: 3f000000
p_memsz: 3f000000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 16a100003000
p_vaddr: ffff96a100001000
p_paddr: 0
p_filesz: 57000
p_memsz: 57000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 6a0000002000
p_vaddr: ffffea0000000000
p_paddr: 0
p_filesz: 2000
p_memsz: 2000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 16a10005b000
p_vaddr: ffff96a100059000
p_paddr: 0
p_filesz: 33000
p_memsz: 33000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 16a100102000
p_vaddr: ffff96a100100000
p_paddr: 0
p_filesz: 77b5f000
p_memsz: 77b5f000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 6a0000006000
p_vaddr: ffffea0000004000
p_paddr: 0
p_filesz: 1dee000
p_memsz: 1dee000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 16a177c63000
p_vaddr: ffff96a177c61000
p_paddr: 0
p_filesz: 2fb000
p_memsz: 2fb000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 16a177f5f000
p_vaddr: ffff96a177f5d000
p_paddr: 0
p_filesz: 34af4000
p_memsz: 34af4000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 6a0001dff000
p_vaddr: ffffea0001dfd000
p_paddr: 0
p_filesz: d2d000
p_memsz: d2d000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 16a1aca7e000
p_vaddr: ffff96a1aca7c000
p_paddr: 0
p_filesz: 9903000
p_memsz: 9903000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 16a1b8001000
p_vaddr: ffff96a1b7fff000
p_paddr: 0
p_filesz: 1000
p_memsz: 1000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 6a0002e01000
p_vaddr: ffffea0002dff000
p_paddr: 0
p_filesz: 1000
p_memsz: 1000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 16a200002000
p_vaddr: ffff96a200000000
p_paddr: 0
p_filesz: 142800000
p_memsz: 142800000
p_align: 4096
Elf64_Phdr:
p_type: 1
p_flags: 7
p_offset: 6a0004002000
p_vaddr: ffffea0004000000
p_paddr: 0
p_filesz: 50a0000
p_memsz: 50a0000
p_align: 4096
readmem: read_proc_kcore() -> /proc/kcore
crash: pv_init_ops exists: ARCH_PVOPS
_text: ffffffff81000000 Kernel code: 1aaa00000 -> phys_base: 1a9a00000
gdb /usr/lib/debug/boot/vmlinux-4.8.0-46-generic
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
<readmem: ffffffff81f5dcc0, KVADDR, "possible", 64, (ROE), 55f59c515060>
<read_proc_kcore: addr: ffffffff81f5dcc0 paddr: 1ab95dcc0 cnt: 64>
crash: seek error: kernel virtual address: ffffffff81f5dcc0 type: "possible"
WARNING: cannot read cpu_possible_map
<readmem: ffffffff81f5dc40, KVADDR, "present", 64, (ROE), 55f59c515060>
<read_proc_kcore: addr: ffffffff81f5dc40 paddr: 1ab95dc40 cnt: 64>
crash: seek error: kernel virtual address: ffffffff81f5dc40 type: "present"
WARNING: cannot read cpu_present_map
<readmem: ffffffff81f5dc80, KVADDR, "online", 64, (ROE), 55f59c515060>
<read_proc_kcore: addr: ffffffff81f5dc80 paddr: 1ab95dc80 cnt: 64>
crash: seek error: kernel virtual address: ffffffff81f5dc80 type: "online"
WARNING: cannot read cpu_online_map
<readmem: ffffffff81f5dc00, KVADDR, "active", 64, (ROE), 55f59c515060>
<read_proc_kcore: addr: ffffffff81f5dc00 paddr: 1ab95dc00 cnt: 64>
crash: seek error: kernel virtual address: ffffffff81f5dc00 type: "active"
WARNING: cannot read cpu_active_map
<readmem: ffffffff81e2a070, KVADDR, "pv_init_ops", 8, (ROE), 7fff3eafb4b0>
<read_proc_kcore: addr: ffffffff81e2a070 paddr: 1ab82a070 cnt: 8>
crash: seek error: kernel virtual address: ffffffff81e2a070 type: "pv_init_ops"
<readmem: ffffffff82167130, KVADDR, "shadow_timekeeper xtime_sec", 8,
(ROE), 7fff3eafb460>
<read_proc_kcore: addr: ffffffff82167130 paddr: 1abb67130 cnt: 8>
crash: seek error: kernel virtual address: ffffffff82167130 type:
"shadow_timekeeper xtime_sec"
xtime timespec.tv_sec: 8: Thu Jan 1 05:30:08 1970
<readmem: ffffffff81e0d304, KVADDR, "init_uts_ns", 390, (ROE), 55f59c2b9e3c>
<read_proc_kcore: addr: ffffffff81e0d304 paddr: 1ab80d304 cnt: 390>
crash: seek error: kernel virtual address: ffffffff81e0d304 type: "init_uts_ns"
utsname:
sysname:
nodename:
release:
version:
machine:
domainname:
base kernel version: 0.0.0
<readmem: ffffffff81a000c0, KVADDR, "accessible check", 8, (ROE|Q),
7fff3eaf87b0>
<read_proc_kcore: addr: ffffffff81a000c0 paddr: 1ab4000c0 cnt: 8>
crash: seek error: kernel virtual address: ffffffff81a000c0 type:
"accessible check"
crash: /boot/System.map-4.8.0-46-generic and /proc/kcore do not match!
Usage:
crash [OPTION]... NAMELIST MEMORY-IMAGE[@ADDRESS] (dumpfile form)
crash [OPTION]... [NAMELIST] (live system form)
Enter "crash -h" for details.
$
The similar procedure worked just fine on [L]Ubuntu 15.10.
Any help in solving this would be appreciated, TIA!
-Kaiwan.
Thanks & Regards,
Kaiwan.
7 years, 8 months
[PATCH] Fix for the "trace.c" extension module
by Fei Jie
Fix for the "trace.c" extension module due to upstream
changes in kernel/trace/ring_buffer.c which changes the size of
ring_buffer_per_cpu.nr_pages field from an int to a long.
---
extensions/trace.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/extensions/trace.c b/extensions/trace.c
index a93abdc..dfa8be9 100644
--- a/extensions/trace.c
+++ b/extensions/trace.c
@@ -96,7 +96,7 @@ struct ring_buffer_per_cpu {
ulong real_head_page;
int head_page_index;
- unsigned int nr_pages;
+ unsigned long nr_pages;
ulong *pages;
ulong *linear_pages;
@@ -430,7 +430,13 @@ static int ftrace_init_buffers(struct ring_buffer_per_cpu *buffers,
buffer_read_value(overrun);
buffer_read_value(entries);
if (per_cpu_buffer_sizes) {
- buffer_read_value(nr_pages);
+ if (MEMBER_SIZE("ring_buffer_per_cpu", "nr_pages") == sizeof(unsigned int)) {
+ unsigned int tmp_nr_pages;
+ read_value(tmp_nr_pages, buffers[i].kaddr, ring_buffer_per_cpu, nr_pages);
+ buffers[i].nr_pages = (unsigned long) tmp_nr_pages;
+ } else {
+ buffer_read_value(nr_pages);
+ }
pages = buffers[i].nr_pages;
} else
buffers[i].nr_pages = pages;
--
1.8.3.1
7 years, 8 months
[PATCH] kmem: Introduce basic hugetlb usage data with 'kmem -i'
by Aaron Tomlin
Provide basic hugetlb usage as seen in /proc/meminfo for example:
crash> kmem -i
PAGES TOTAL PERCENTAGE
TOTAL MEM 1931928 7.4 GB ----
FREE 210771 823.3 MB 10% of TOTAL MEM
USED 1721157 6.6 GB 89% of TOTAL MEM
SHARED 338699 1.3 GB 17% of TOTAL MEM
BUFFERS 61676 240.9 MB 3% of TOTAL MEM
CACHED 0 0 0% of TOTAL MEM
SLAB 34280 133.9 MB 1% of TOTAL MEM
TOTAL HUGE 524288 2 GB ----
HUGE FREE 524288 2 GB 100% of TOTAL HUGE
TOTAL SWAP 1970175 7.5 GB ----
SWAP USED 30 120 KB 0% of TOTAL SWAP
SWAP FREE 1970145 7.5 GB 99% of TOTAL SWAP
COMMIT LIMIT 2673995 10.2 GB ----
COMMITTED 2068155 7.9 GB 77% of TOTAL LIMIT
Signed-off-by: Aaron Tomlin <atomlin(a)redhat.com>
---
help.c | 3 +++
memory.c | 41 +++++++++++++++++++++++++++++++++++------
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/help.c b/help.c
index 4ce2e0a..3be7dc4 100644
--- a/help.c
+++ b/help.c
@@ -5981,6 +5981,9 @@ char *help_kmem[] = {
" CACHED 1276196 4.9 GB 64% of TOTAL MEM",
" SLAB 120410 470.4 MB 6% of TOTAL MEM",
" ",
+" TOTAL HUGE 524288 2 GB ----",
+" HUGE FREE 524288 2 GB 100% of TOTAL HUGE",
+" ",
" TOTAL SWAP 2498559 9.5 GB ----",
" SWAP USED 81978 320.2 MB 3% of TOTAL SWAP",
" SWAP FREE 2416581 9.2 GB 96% of TOTAL SWAP",
diff --git a/memory.c b/memory.c
index 99ea8be..08b5794 100644
--- a/memory.c
+++ b/memory.c
@@ -237,7 +237,7 @@ static int vm_area_page_dump(ulong, ulong, ulong, ulong, ulong,
struct reference *);
static void rss_page_types_init(void);
static int dump_swap_info(ulong, ulong *, ulong *);
-static int get_hugetlb_total_pages(ulong *);
+static int get_hugetlb_total_pages(ulong *, ulong *);
static void swap_info_init(void);
static char *get_swapdev(ulong, char *);
static void fill_swap_info(ulong);
@@ -8111,7 +8111,8 @@ dump_kmeminfo(void)
long committed;
ulong overcommit_kbytes = 0;
int overcommit_ratio;
- ulong hugetlb_total_pages;
+ ulong hugetlb_total_pages, hugetlb_total_free_pages = 0;
+ int done_hugetlb_calc = 0;
long nr_file_pages, nr_slab;
ulong swapper_space_nrpages;
ulong pct;
@@ -8319,6 +8320,22 @@ dump_kmeminfo(void)
pages_to_size(freelowmem_pages, buf), pct);
}
+ if (get_hugetlb_total_pages(&hugetlb_total_pages,
+ &hugetlb_total_free_pages)) {
+ done_hugetlb_calc = 1;
+
+ fprintf(fp, "\n%13s %7ld %11s ----\n",
+ "TOTAL HUGE", hugetlb_total_pages,
+ pages_to_size(hugetlb_total_pages, buf));
+ pct = hugetlb_total_free_pages ?
+ (hugetlb_total_free_pages * 100) /
+ hugetlb_total_pages : 0;
+ fprintf(fp, "%13s %7ld %11s %3ld%% of TOTAL HUGE\n",
+ "HUGE FREE",
+ hugetlb_total_free_pages,
+ pages_to_size(hugetlb_total_free_pages, buf), pct);
+ }
+
/*
* get swap data from dump_swap_info().
*/
@@ -8347,6 +8364,7 @@ dump_kmeminfo(void)
"swap_info[%ld].swap_map at %lx is inaccessible\n",
totalused_pages, totalswap_pages);
}
+
/*
* Show committed memory
*/
@@ -8364,7 +8382,7 @@ dump_kmeminfo(void)
get_symbol_data("sysctl_overcommit_ratio",
sizeof(int), &overcommit_ratio);
- if (!get_hugetlb_total_pages(&hugetlb_total_pages))
+ if (!done_hugetlb_calc)
goto bailout;
allowed = ((totalram_pages - hugetlb_total_pages)
@@ -15293,19 +15311,21 @@ next_physpage(ulonglong paddr, ulonglong *nextpaddr)
}
static int
-get_hugetlb_total_pages(ulong *nr_total_pages)
+get_hugetlb_total_pages(ulong *nr_total_pages, ulong *nr_total_free_pages)
{
ulong hstate_p, vaddr;
int i, len;
ulong nr_huge_pages;
+ ulong free_huge_pages;
uint horder;
- *nr_total_pages = 0;
+ *nr_total_pages = *nr_total_free_pages = 0;
if (kernel_symbol_exists("hstates")) {
if (INVALID_SIZE(hstate) ||
INVALID_MEMBER(hstate_order) ||
- INVALID_MEMBER(hstate_nr_huge_pages))
+ INVALID_MEMBER(hstate_nr_huge_pages) ||
+ INVALID_MEMBER(hstate_free_huge_pages))
return FALSE;
len = get_array_length("hstates", NULL, 0);
@@ -15325,7 +15345,12 @@ get_hugetlb_total_pages(ulong *nr_total_pages)
KVADDR, &nr_huge_pages, sizeof(ulong),
"hstate_nr_huge_pages", FAULT_ON_ERROR);
+ readmem(vaddr + OFFSET(hstate_free_huge_pages),
+ KVADDR, &free_huge_pages, sizeof(ulong),
+ "hstate_free_huge_pages", FAULT_ON_ERROR);
+
*nr_total_pages += nr_huge_pages * (1 << horder);
+ *nr_total_free_pages += free_huge_pages * (1 << horder);
}
} else if (kernel_symbol_exists("nr_huge_pages")) {
unsigned long hpage_shift = 21;
@@ -15334,8 +15359,12 @@ get_hugetlb_total_pages(ulong *nr_total_pages)
hpage_shift = 22;
get_symbol_data("nr_huge_pages",
sizeof(ulong), &nr_huge_pages);
+ get_symbol_data("free_huge_pages",
+ sizeof(ulong), &free_huge_pages);
*nr_total_pages = nr_huge_pages * ((1 << hpage_shift) /
machdep->pagesize);
+ *nr_total_free_pages = free_huge_pages *
+ ((1 << hpage_shift) / machdep->pagesize);
}
return TRUE;
}
--
2.9.3
7 years, 8 months