Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct mem.vmstat.pgsteal* mem.vmstat.pgscan metrics on RHEL7 and Fedora 25 #276

Closed
wcohen opened this issue Feb 17, 2017 · 3 comments
Closed

Comments

@wcohen
Copy link
Contributor

wcohen commented Feb 17, 2017

PCP on x86_64 RHEL7 and Fedora 25 lists the following pgsteal metrics:

$ pminfo mem.vmstat|grep pgsteal
mem.vmstat.pgsteal_dma
mem.vmstat.pgsteal_dma32
mem.vmstat.pgsteal_high
mem.vmstat.pgsteal_movable
mem.vmstat.pgsteal_normal

However, doing pmval for each of these pgsteal metrics on RHEL7 and F25 return "No values available". Those metrics do not appear to line up with what /proc/vmstat provide for RHEL7 and F25:

RHEL7:

$ more /proc/vmstat |grep pgsteal
pgsteal_kswapd_dma 0
pgsteal_kswapd_dma32 0
pgsteal_kswapd_normal 0
pgsteal_kswapd_movable 0
pgsteal_direct_dma 0
pgsteal_direct_dma32 0
pgsteal_direct_normal 0
pgsteal_direct_movable 0

F25:
$ more /proc/vmstat |grep pgsteal
pgsteal_kswapd 3543984
pgsteal_direct 290756

For Fedora 25 the pgscan metrics don't match with what is available in /proc/vmstat:

[wcohen@santana perf]$ pminfo mem.vmstat|grep pgscan
mem.vmstat.pgscan_direct_dma
mem.vmstat.pgscan_direct_dma32
mem.vmstat.pgscan_direct_high
mem.vmstat.pgscan_direct_movable
mem.vmstat.pgscan_direct_normal
mem.vmstat.pgscan_kswapd_dma
mem.vmstat.pgscan_kswapd_dma32
mem.vmstat.pgscan_kswapd_high
mem.vmstat.pgscan_kswapd_movable
mem.vmstat.pgscan_kswapd_normal
[wcohen@santana perf]$ more /proc/vmstat |grep pgscan
pgscan_kswapd 3679442
pgscan_direct 424948
pgscan_direct_throttle 0

@wcohen
Copy link
Contributor Author

wcohen commented Feb 21, 2017

I am not sure how many of these missing metrics in /proc/vmstat are generally useful in addition to the pgscan and pgsteal ones. Wrote a one line script to see /proc/vmstat metrics listed are missing from PCP mem.vmstat.*:

for i in cat /proc/vmstat|awk '{print $1}'; do pmprobe mem.vmstat.${i}; done | awk '$2 < 0 {print $1}' |sort

On Fedora 25:
$ for i in cat /proc/vmstat|awk '{print $1}'; do pmprobe mem.vmstat.${i}; done | awk '$2 < 0 {print $1}' | sort
mem.vmstat.allocstall_dma
mem.vmstat.allocstall_dma32
mem.vmstat.allocstall_movable
mem.vmstat.allocstall_normal
mem.vmstat.compact_daemon_wake
mem.vmstat.compact_free_scanned
mem.vmstat.compact_isolated
mem.vmstat.compact_migrate_scanned
mem.vmstat.drop_pagecache
mem.vmstat.drop_slab
mem.vmstat.nr_file_pages
mem.vmstat.nr_free_cma
mem.vmstat.nr_pages_scanned
mem.vmstat.nr_shmem_hugepages
mem.vmstat.nr_shmem_pmdmapped
mem.vmstat.nr_vmscan_immediate_reclaim
mem.vmstat.nr_zone_active_anon
mem.vmstat.nr_zone_active_file
mem.vmstat.nr_zone_inactive_anon
mem.vmstat.nr_zone_inactive_file
mem.vmstat.nr_zone_unevictable
mem.vmstat.nr_zone_write_pending
mem.vmstat.nr_zspages
mem.vmstat.numa_hint_faults
mem.vmstat.numa_hint_faults_local
mem.vmstat.numa_huge_pte_updates
mem.vmstat.numa_pages_migrated
mem.vmstat.numa_pte_updates
mem.vmstat.pglazyfreed
mem.vmstat.pgmigrate_fail
mem.vmstat.pgmigrate_success
mem.vmstat.pgrefill
mem.vmstat.pgscan_direct
mem.vmstat.pgscan_direct_throttle
mem.vmstat.pgscan_kswapd
mem.vmstat.pgskip_dma
mem.vmstat.pgskip_dma32
mem.vmstat.pgskip_movable
mem.vmstat.pgskip_normal
mem.vmstat.pgsteal_direct
mem.vmstat.pgsteal_kswapd
mem.vmstat.thp_deferred_split_page
mem.vmstat.thp_file_alloc
mem.vmstat.thp_file_mapped
mem.vmstat.thp_split_page
mem.vmstat.thp_split_page_failed
mem.vmstat.thp_split_pmd
mem.vmstat.workingset_activate
mem.vmstat.workingset_nodereclaim
mem.vmstat.workingset_refault

On RHEL7:

$ for i in cat /proc/vmstat|awk '{print $1}'; do pmprobe mem.vmstat.${i}; done | awk '$2 < 0 {print $1}' |sort
mem.vmstat.compact_free_scanned
mem.vmstat.compact_isolated
mem.vmstat.compact_migrate_scanned
mem.vmstat.drop_pagecache
mem.vmstat.drop_slab
mem.vmstat.nr_alloc_batch
mem.vmstat.nr_file_pages
mem.vmstat.nr_free_cma
mem.vmstat.nr_vmscan_immediate_reclaim
mem.vmstat.numa_hint_faults
mem.vmstat.numa_hint_faults_local
mem.vmstat.numa_huge_pte_updates
mem.vmstat.numa_pages_migrated
mem.vmstat.numa_pte_updates
mem.vmstat.pgmigrate_fail
mem.vmstat.pgmigrate_success
mem.vmstat.pgscan_direct_throttle
mem.vmstat.pgsteal_direct_dma
mem.vmstat.pgsteal_direct_dma32
mem.vmstat.pgsteal_direct_movable
mem.vmstat.pgsteal_direct_normal
mem.vmstat.pgsteal_kswapd_dma
mem.vmstat.pgsteal_kswapd_dma32
mem.vmstat.pgsteal_kswapd_movable
mem.vmstat.pgsteal_kswapd_normal
mem.vmstat.workingset_activate
mem.vmstat.workingset_nodereclaim
mem.vmstat.workingset_refault

@fche
Copy link
Contributor

fche commented Feb 21, 2017

The way that src/pmdas/linux/proc_vmstat.c is written the metrics are hard-coded in C in the vmstat_fields[] array. When it scans /proc/vmstat, it does a linear search against the vmstat_fields[] list to deposit parsed fields in the global _proc_vmstat_t structure. It's not particularly efficient, nor flexible.

It could instead generate the vmstat pmns entries dynamically from the actual contents of /proc/vmstat, and pass every value out as an int64_t, and ditch all the hard-coded proc_vmstat_t etc. machinery.

@myllynen
Copy link
Contributor

myllynen commented Nov 20, 2017

On Fedora 27 with PCP 3.12.2 / kernel 4.13 pgscan/pgsteal metrics are missing completely.

With PCP 3.12.2 we have:

$ pminfo | grep -E '(pgscan|pgsteal)' | sort
mem.vmstat.pgscan_direct_dma
mem.vmstat.pgscan_direct_dma32
mem.vmstat.pgscan_direct_high
mem.vmstat.pgscan_direct_movable
mem.vmstat.pgscan_direct_normal
mem.vmstat.pgscan_kswapd_dma
mem.vmstat.pgscan_kswapd_dma32
mem.vmstat.pgscan_kswapd_high
mem.vmstat.pgscan_kswapd_movable
mem.vmstat.pgscan_kswapd_normal
mem.vmstat.pgsteal_direct_dma
mem.vmstat.pgsteal_direct_dma32
mem.vmstat.pgsteal_direct_movable
mem.vmstat.pgsteal_direct_normal
mem.vmstat.pgsteal_dma
mem.vmstat.pgsteal_dma32
mem.vmstat.pgsteal_high
mem.vmstat.pgsteal_kswapd_dma
mem.vmstat.pgsteal_kswapd_dma32
mem.vmstat.pgsteal_kswapd_movable
mem.vmstat.pgsteal_kswapd_normal
mem.vmstat.pgsteal_movable
mem.vmstat.pgsteal_normal

And this works with RHEL 6 which has:

$ cat /proc/vmstat | grep -E '(pgscan|pgsteal)' | sort
pgscan_direct_dma 0
pgscan_direct_dma32 0
pgscan_direct_movable 0
pgscan_direct_normal 0
pgscan_kswapd_dma 0
pgscan_kswapd_dma32 0
pgscan_kswapd_movable 0
pgscan_kswapd_normal 0
pgsteal_dma 0
pgsteal_dma32 0
pgsteal_movable 0
pgsteal_normal 0

And RHEL 7 which has:

$ cat /proc/vmstat | grep -E '(pgscan|pgsteal)' | sort
pgscan_direct_dma 0
pgscan_direct_dma32 0
pgscan_direct_movable 0
pgscan_direct_normal 0
pgscan_direct_throttle 0
pgscan_kswapd_dma 0
pgscan_kswapd_dma32 0
pgscan_kswapd_movable 0
pgscan_kswapd_normal 0
pgsteal_direct_dma 0
pgsteal_direct_dma32 0
pgsteal_direct_movable 0
pgsteal_direct_normal 0
pgsteal_kswapd_dma 0
pgsteal_kswapd_dma32 0
pgsteal_kswapd_movable 0
pgsteal_kswapd_normal 0

However, on Fedora 27 / kernel 4.13 we have:

$ cat /proc/vmstat | grep -E '(pgscan|pgsteal)' | sort
pgscan_direct 0
pgscan_direct_throttle 0
pgscan_kswapd 0
pgsteal_direct 0
pgsteal_kswapd 0

This means, for example, that stats corresponding to sar -B are impossible to generate with PCP.

Below are few somewhat relevant links for reference:

https://github.com/torvalds/linux/blob/master/include/linux/vm_event_item.h
torvalds/linux@904249a
torvalds/linux@68243e7
torvalds/linux@599d0c9

Please update the PMDA for latest kernel. Thanks.

natoscott added a commit that referenced this issue Nov 22, 2017
Adds mem.vmstat.pgscan_{direct,direct_throttle,kswapd}
and mem.vmstat.pgsteal_{direct,kswapd}.

Test 821 is extended with new data to cover these cases
- thanks Marko.

Resolves github issue #276.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants