zram: fix missing zero pages for memory tracking
Subsystems (3)
Minchan Kim
maintainerPATCH 1/1 zram: fix missing zero pages for memory tracking
We need to count zero filled pages as well as other pages in zram. Otherwise, it doesn't match swap page count via pagemap of process so that memory tracking feature in zram doesn't provide accurate information.
--- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/zram/zram_drv.c +1 -1
@@ -71,7 +71,7 @@ static inline bool init_done(struct zram *zram)static inline bool zram_allocated (struct zram *zram,u32 index) { -return (zram->table[index].value >> (ZRAM_FLAG_SHIFT +1 )) || +return zram->table[index].value >>ZRAM_FLAG_SHIFT || zram->table[index].handle; }
Signature · 1 line
2.19.0.397.gdd90340f6a-goog
Quoted 1 line · Minchan Kim
We need to count zero filled pages as well as other pages in zram.
A nit,
'ZRAM_FLAG_SHIFT + 1' covers all ZRAM_SAME pages, not only
zero filled pages.
-ss
Minchan Kim
maintainerHi Sergey,
Quoted 7 lines · Sergey Senozhatsky
Quoted 1 line · Minchan Kim
We need to count zero filled pages as well as other pages in zram.
A nit,
'
ZRAM_FLAG_SHIFT+ 1' covers allZRAM_SAMEpages, not only
zero filled pages.
Yub, that's what I want.
Currently, it covers only non-zero filled same page, which is inconsistent and user easily miss zero-filled same page.
Minchan Kim
maintainerQuoted 7 lines · Sergey Senozhatsky
Quoted 1 line · Minchan Kim
We need to count zero filled pages as well as other pages in zram.
A nit,
'
ZRAM_FLAG_SHIFT+ 1' covers allZRAM_SAMEpages, not only
zero filled pages.
Ah, now I got your point. I was brainfart.
I will drop this patch and find other reason I have missed.
Thanks, Sergey.
Quoted 10 lines · Minchan Kim
Quoted 7 lines · Sergey Senozhatsky
Quoted 1 line · Minchan Kim
We need to count zero filled pages as well as other pages in zram.
A nit,
'
ZRAM_FLAG_SHIFT+ 1' covers allZRAM_SAMEpages, not only
zero filled pages.I was brainfart.
No, never :) And I totally didn't mean it.
-ss