1*7c33c6c4SSeongJae Park.. SPDX-License-Identifier: GPL-2.0 2*7c33c6c4SSeongJae Park 3*7c33c6c4SSeongJae Park=================================== 4*7c33c6c4SSeongJae ParkData Access Monitoring Results Stat 5*7c33c6c4SSeongJae Park=================================== 6*7c33c6c4SSeongJae Park 7*7c33c6c4SSeongJae ParkData Access Monitoring Results Stat (DAMON_STAT) is a static kernel module that 8*7c33c6c4SSeongJae Parkis aimed to be used for simple access pattern monitoring. It monitors accesses 9*7c33c6c4SSeongJae Parkon the system's entire physical memory using DAMON, and provides simplified 10*7c33c6c4SSeongJae Parkaccess monitoring results statistics, namely idle time percentiles and 11*7c33c6c4SSeongJae Parkestimated memory bandwidth. 12*7c33c6c4SSeongJae Park 13*7c33c6c4SSeongJae ParkMonitoring Accuracy and Overhead 14*7c33c6c4SSeongJae Park================================ 15*7c33c6c4SSeongJae Park 16*7c33c6c4SSeongJae ParkDAMON_STAT uses monitoring intervals :ref:`auto-tuning 17*7c33c6c4SSeongJae Park<damon_design_monitoring_intervals_autotuning>` to make its accuracy high and 18*7c33c6c4SSeongJae Parkoverhead minimum. It auto-tunes the intervals aiming 4 % of observable access 19*7c33c6c4SSeongJae Parkevents to be captured in each snapshot, while limiting the resulting sampling 20*7c33c6c4SSeongJae Parkevents to be 5 milliseconds in minimum and 10 seconds in maximum. On a few 21*7c33c6c4SSeongJae Parkproduction server systems, it resulted in consuming only 0.x % single CPU time, 22*7c33c6c4SSeongJae Parkwhile capturing reasonable quality of access patterns. 23*7c33c6c4SSeongJae Park 24*7c33c6c4SSeongJae ParkInterface: Module Parameters 25*7c33c6c4SSeongJae Park============================ 26*7c33c6c4SSeongJae Park 27*7c33c6c4SSeongJae ParkTo use this feature, you should first ensure your system is running on a kernel 28*7c33c6c4SSeongJae Parkthat is built with ``CONFIG_DAMON_STAT=y``. The feature can be enabled by 29*7c33c6c4SSeongJae Parkdefault at build time, by setting ``CONFIG_DAMON_STAT_ENABLED_DEFAULT`` true. 30*7c33c6c4SSeongJae Park 31*7c33c6c4SSeongJae ParkTo let sysadmins enable or disable it at boot and/or runtime, and read the 32*7c33c6c4SSeongJae Parkmonitoring results, DAMON_STAT provides module parameters. Following 33*7c33c6c4SSeongJae Parksections are descriptions of the parameters. 34*7c33c6c4SSeongJae Park 35*7c33c6c4SSeongJae Parkenabled 36*7c33c6c4SSeongJae Park------- 37*7c33c6c4SSeongJae Park 38*7c33c6c4SSeongJae ParkEnable or disable DAMON_STAT. 39*7c33c6c4SSeongJae Park 40*7c33c6c4SSeongJae ParkYou can enable DAMON_STAT by setting the value of this parameter as ``Y``. 41*7c33c6c4SSeongJae ParkSetting it as ``N`` disables DAMON_STAT. The default value is set by 42*7c33c6c4SSeongJae Park``CONFIG_DAMON_STAT_ENABLED_DEFAULT`` build config option. 43*7c33c6c4SSeongJae Park 44*7c33c6c4SSeongJae Parkestimated_memory_bandwidth 45*7c33c6c4SSeongJae Park-------------------------- 46*7c33c6c4SSeongJae Park 47*7c33c6c4SSeongJae ParkEstimated memory bandwidth consumption (bytes per second) of the system. 48*7c33c6c4SSeongJae Park 49*7c33c6c4SSeongJae ParkDAMON_STAT reads observed access events on the current DAMON results snapshot 50*7c33c6c4SSeongJae Parkand converts it to memory bandwidth consumption estimation in bytes per second. 51*7c33c6c4SSeongJae ParkThe resulting metric is exposed to user via this read-only parameter. Because 52*7c33c6c4SSeongJae ParkDAMON uses sampling, this is only an estimation of the access intensity rather 53*7c33c6c4SSeongJae Parkthan accurate memory bandwidth. 54*7c33c6c4SSeongJae Park 55*7c33c6c4SSeongJae Parkmemory_idle_ms_percentiles 56*7c33c6c4SSeongJae Park-------------------------- 57*7c33c6c4SSeongJae Park 58*7c33c6c4SSeongJae ParkPer-byte idle time (milliseconds) percentiles of the system. 59*7c33c6c4SSeongJae Park 60*7c33c6c4SSeongJae ParkDAMON_STAT calculates how long each byte of the memory was not accessed until 61*7c33c6c4SSeongJae Parknow (idle time), based on the current DAMON results snapshot. If DAMON found a 62*7c33c6c4SSeongJae Parkregion of access frequency (nr_accesses) larger than zero, every byte of the 63*7c33c6c4SSeongJae Parkregion gets zero idle time. If a region has zero access frequency 64*7c33c6c4SSeongJae Park(nr_accesses), how long the region was keeping the zero access frequency (age) 65*7c33c6c4SSeongJae Parkbecomes the idle time of every byte of the region. Then, DAMON_STAT exposes 66*7c33c6c4SSeongJae Parkthe percentiles of the idle time values via this read-only parameter. Reading 67*7c33c6c4SSeongJae Parkthe parameter returns 101 idle time values in milliseconds, separated by comma. 68*7c33c6c4SSeongJae ParkEach value represents 0-th, 1st, 2nd, 3rd, ..., 99th and 100th percentile idle 69*7c33c6c4SSeongJae Parktimes. 70