Sungju's Slow Life

Personal journal


Difference between ‘pgscank/s’ and ‘pgscand/s’

In the sar output like below, there are pgscank and pgscand. In the man page, it says.

pgscank/s
Number of pages scanned by the kswapd daemon per second.
pgscand/s
Number of pages scanned directly per second.
12:00:01 AM  pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
...

This description is not much helpful to understand the difference between those two columns. These data are from kernel code which is showing in vmstat. It is basically updated when there’s memory reclaiming. If the reclaiming was happened by kswapd, it’ll go to pgscank/s. Otherwise, it’ll go to pgscand/s.

static noinline_for_stack unsigned long
shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
             struct scan_control *sc, enum lru_list lru)
{
    LIST_HEAD(page_list);

...

    if (global_reclaim(sc)) {
        zone->pages_scanned += nr_scanned;
        if (current_is_kswapd())
            __count_zone_vm_events(PGSCAN_KSWAPD, zone, nr_scanned);
        else
            __count_zone_vm_events(PGSCAN_DIRECT, zone, nr_scanned);
    }
...



Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.