mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 22:37:45 -04:00
zram: count same page write as page_stored
Regardless of whether it is same page or not, it's surely write and stored to zram so we should increase pages_stored stat. Otherwise, user can see zero value via mm_stats although he writes a lot of pages to zram. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Minchan Kim <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
80b18dfa53
commit
51f9f82c85
1 file changed
+2
@@ -469,6 +469,7 @@ static bool zram_same_page_write(struct zram *zram, u32 index,
|
||||
zram_slot_unlock(zram, index);
|
||||
|
||||
atomic64_inc(&zram->stats.same_pages);
|
||||
atomic64_inc(&zram->stats.pages_stored);
|
||||
return true;
|
||||
}
|
||||
kunmap_atomic(mem);
|
||||
@@ -524,6 +525,7 @@ static void zram_free_page(struct zram *zram, size_t index)
|
||||
zram_clear_flag(zram, index, ZRAM_SAME);
|
||||
zram_set_element(zram, index, 0);
|
||||
atomic64_dec(&zram->stats.same_pages);
|
||||
atomic64_dec(&zram->stats.pages_stored);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user