All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zram: fix missing zero pages for memory tracking
@ 2018-09-19  5:18 Minchan Kim
  2018-09-19  7:29 ` Sergey Senozhatsky
  0 siblings, 1 reply; 5+ messages in thread
From: Minchan Kim @ 2018-09-19  5:18 UTC (permalink / raw
  To: LKML, Andrew Morton; +Cc: Minchan Kim, Sergey Senozhatsky, stable

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.

Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: <stable@vger.kernel.org>    [4.18+]
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 drivers/block/zram/zram_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index a1d6b5597c17..40d303d8826f 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -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;
 }
 
-- 
2.19.0.397.gdd90340f6a-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] zram: fix missing zero pages for memory tracking
  2018-09-19  5:18 [PATCH] zram: fix missing zero pages for memory tracking Minchan Kim
@ 2018-09-19  7:29 ` Sergey Senozhatsky
  2018-09-20 11:12   ` Minchan Kim
  2018-09-22  3:11   ` Minchan Kim
  0 siblings, 2 replies; 5+ messages in thread
From: Sergey Senozhatsky @ 2018-09-19  7:29 UTC (permalink / raw
  To: Minchan Kim; +Cc: LKML, Andrew Morton, Sergey Senozhatsky, stable

On (09/19/18 14:18), Minchan Kim wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zram: fix missing zero pages for memory tracking
  2018-09-19  7:29 ` Sergey Senozhatsky
@ 2018-09-20 11:12   ` Minchan Kim
  2018-09-22  3:11   ` Minchan Kim
  1 sibling, 0 replies; 5+ messages in thread
From: Minchan Kim @ 2018-09-20 11:12 UTC (permalink / raw
  To: Sergey Senozhatsky; +Cc: LKML, Andrew Morton, stable

Hi Sergey,

On Wed, Sep 19, 2018 at 04:29:16PM +0900, Sergey Senozhatsky wrote:
> On (09/19/18 14:18), Minchan Kim wrote:
> > 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.

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zram: fix missing zero pages for memory tracking
  2018-09-19  7:29 ` Sergey Senozhatsky
  2018-09-20 11:12   ` Minchan Kim
@ 2018-09-22  3:11   ` Minchan Kim
  2018-10-01 10:08     ` Sergey Senozhatsky
  1 sibling, 1 reply; 5+ messages in thread
From: Minchan Kim @ 2018-09-22  3:11 UTC (permalink / raw
  To: Sergey Senozhatsky; +Cc: LKML, Andrew Morton, stable

On Wed, Sep 19, 2018 at 04:29:16PM +0900, Sergey Senozhatsky wrote:
> On (09/19/18 14:18), Minchan Kim wrote:
> > 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.

Ah, now I got your point. I was brainfart.
I will drop this patch and find other reason I have missed.

Thanks, Sergey.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zram: fix missing zero pages for memory tracking
  2018-09-22  3:11   ` Minchan Kim
@ 2018-10-01 10:08     ` Sergey Senozhatsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Senozhatsky @ 2018-10-01 10:08 UTC (permalink / raw
  To: Minchan Kim; +Cc: Sergey Senozhatsky, LKML, Andrew Morton, stable

On (09/22/18 12:11), Minchan Kim wrote:
> On Wed, Sep 19, 2018 at 04:29:16PM +0900, Sergey Senozhatsky wrote:
> > On (09/19/18 14:18), Minchan Kim wrote:
> > > 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.
> 
> I was brainfart.

No, never :) And I totally didn't mean it.

	-ss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-01 10:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-19  5:18 [PATCH] zram: fix missing zero pages for memory tracking Minchan Kim
2018-09-19  7:29 ` Sergey Senozhatsky
2018-09-20 11:12   ` Minchan Kim
2018-09-22  3:11   ` Minchan Kim
2018-10-01 10:08     ` Sergey Senozhatsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.