Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a219d99 authored by Minchan Kim's avatar Minchan Kim Committed by Michael Benedict
Browse files

UPSTREAM: 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/1494834068-27004-1-git-send-email-minchan@kernel.org


Signed-off-by: default avatarMinchan Kim <minchan@kernel.org>
Reviewed-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit 51f9f82c855d65ef14c2af10e0d2c86ec332a182)
Signed-off-by: default avatarPeter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: I006d80df413a0fe0fd7dd58e535c6a2c03ab2c9d
parent 3369bb20
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -468,6 +468,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);
@@ -523,6 +524,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;
	}