linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zram: remove zcomp_stream_put() from write_incompressible_page()
@ 2025-01-15  7:19 Sergey Senozhatsky
  2025-01-15 23:28 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2025-01-15  7:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Minchan Kim, linux-mm, linux-kernel, Sergey Senozhatsky

We cannot and should not put per-CPU compression stream in
write_incompressible_page() because that function never gets any
per-CPU streams in the first place.  It's zram_write_page() that
puts the stream before it calls write_incompressible_page().

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
 drivers/block/zram/zram_drv.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 70ecaee25c20..9f5020b077c5 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1683,7 +1683,6 @@ static int write_incompressible_page(struct zram *zram, struct page *page,
 		return PTR_ERR((void *)handle);
 
 	if (!zram_can_store_page(zram)) {
-		zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]);
 		zs_free(zram->mem_pool, handle);
 		return -ENOMEM;
 	}
-- 
2.48.0.rc2.279.g1de40edade-goog



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

* Re: [PATCH] zram: remove zcomp_stream_put() from write_incompressible_page()
  2025-01-15  7:19 [PATCH] zram: remove zcomp_stream_put() from write_incompressible_page() Sergey Senozhatsky
@ 2025-01-15 23:28 ` Andrew Morton
  2025-01-16  0:37   ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2025-01-15 23:28 UTC (permalink / raw)
  To: Sergey Senozhatsky; +Cc: Minchan Kim, linux-mm, linux-kernel

On Wed, 15 Jan 2025 16:19:16 +0900 Sergey Senozhatsky <senozhatsky@chromium.org> wrote:

> We cannot and should not put per-CPU compression stream in
> write_incompressible_page() because that function never gets any
> per-CPU streams in the first place.  It's zram_write_page() that
> puts the stream before it calls write_incompressible_page().
> 
> ...
>
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1683,7 +1683,6 @@ static int write_incompressible_page(struct zram *zram, struct page *page,
>  		return PTR_ERR((void *)handle);
>  
>  	if (!zram_can_store_page(zram)) {
> -		zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]);
>  		zs_free(zram->mem_pool, handle);
>  		return -ENOMEM;
>  	}

I added

Fixes: 485d11509d6d ("zram: factor out ZRAM_HUGE write")

That way, anyone who backports 485d11509d6d into their earlier kernel
will have a better chance of noticing that they need this fixup.



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

* Re: [PATCH] zram: remove zcomp_stream_put() from write_incompressible_page()
  2025-01-15 23:28 ` Andrew Morton
@ 2025-01-16  0:37   ` Sergey Senozhatsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2025-01-16  0:37 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Sergey Senozhatsky, Minchan Kim, linux-mm, linux-kernel

On (25/01/15 15:28), Andrew Morton wrote:
> > We cannot and should not put per-CPU compression stream in
> > write_incompressible_page() because that function never gets any
> > per-CPU streams in the first place.  It's zram_write_page() that
> > puts the stream before it calls write_incompressible_page().
> > 
> > ...
> >
> > +++ b/drivers/block/zram/zram_drv.c
> > @@ -1683,7 +1683,6 @@ static int write_incompressible_page(struct zram *zram, struct page *page,
> >  		return PTR_ERR((void *)handle);
> >  
> >  	if (!zram_can_store_page(zram)) {
> > -		zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]);
> >  		zs_free(zram->mem_pool, handle);
> >  		return -ENOMEM;
> >  	}
> 
> I added
> 
> Fixes: 485d11509d6d ("zram: factor out ZRAM_HUGE write")

Thanks.

> That way, anyone who backports 485d11509d6d into their earlier kernel
> will have a better chance of noticing that they need this fixup.

Agreed.


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

end of thread, other threads:[~2025-01-16  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-15  7:19 [PATCH] zram: remove zcomp_stream_put() from write_incompressible_page() Sergey Senozhatsky
2025-01-15 23:28 ` Andrew Morton
2025-01-16  0:37   ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox