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.

Number of pages scanned by the kswapd daemon per second.
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)


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

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

About Me

A software engineer who loves any technologies that makes life easier. That’s why I love Linux and Mac at the same time.


%d bloggers like this: