diff mbox series

zram: remove zcomp_stream_put() from write_incompressible_page()

Message ID 20250115072003.380567-1-senozhatsky@chromium.org (mailing list archive)
State New
Headers show
Series zram: remove zcomp_stream_put() from write_incompressible_page() | expand

Commit Message

Sergey Senozhatsky Jan. 15, 2025, 7:19 a.m. UTC
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(-)

Comments

Andrew Morton Jan. 15, 2025, 11:28 p.m. UTC | #1
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.
Sergey Senozhatsky Jan. 16, 2025, 12:37 a.m. UTC | #2
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.
diff mbox series

Patch

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;
 	}