When zspage is migrated to the other zone, the zone page state should be updated as well, otherwise the NR_ZSPAGE for each zone shows wrong counts including proc/zoneinfo in practice.
Unified · Split
| @@ -2069,6 +2069,11 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage, · 2068 unmodified lines | ||
| 2069 | 2069 | zs_pool_dec_isolated(pool); |
| 2070 | 2070 | } |
| 2071 | 2071 | |
| 2072 | + if (page_zone(newpage) != page_zone(page)) { | |
| 2073 | + dec_zone_page_state(page, NR_ZSPAGES); | |
| 2074 | + inc_zone_page_state(newpage, NR_ZSPAGES); | |
| 2075 | + } | |
| 2076 | + | |
| 2072 | 2077 | reset_page(page); |
| 2073 | 2078 | put_page(page); |
| 2074 | 2079 | page = newpage; |