@@ -25,6 +25,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
FOR_ALL_ZONES(PGALLOC),
PGFREE, PGACTIVATE, PGDEACTIVATE,
PGFAULT, PGMAJFAULT,
+ PGDISCARD_DIRECT,
+ PGDISCARD_KSWAPD,
FOR_ALL_ZONES(PGREFILL),
FOR_ALL_ZONES(PGSTEAL_KSWAPD),
FOR_ALL_ZONES(PGSTEAL_DIRECT),
@@ -756,6 +756,8 @@ const char * const vmstat_text[] = {
"pgfault",
"pgmajfault",
+ "pgdiscard_direct",
+ "pgdiscard_kswapd",
TEXTS_FOR_ZONES("pgrefill")
TEXTS_FOR_ZONES("pgsteal_kswapd")
@@ -894,6 +894,10 @@ int discard_vpage(struct page *page)
if (page_freeze_refs(page, 1)) {
unlock_page(page);
+ if (current_is_kswapd())
+ count_vm_event(PGDISCARD_KSWAPD);
+ else
+ count_vm_event(PGDISCARD_DIRECT);
return 0;
}
}
@@ -1144,6 +1148,12 @@ static int discard_vrange(struct vrange *vrange)
ret = __discard_vrange_file(mapping, vrange, &nr_discard);
}
+ if (!ret) {
+ if (current_is_kswapd())
+ count_vm_events(PGDISCARD_KSWAPD, nr_discard);
+ else
+ count_vm_events(PGDISCARD_DIRECT, nr_discard);
+ }
out:
__vroot_put(vroot);
return nr_discard;