* [PATCH 1/7] zram: allocate comp only if it is supported
2026-12-01 9:06 [PATCH 0/7] zram: a set of trivial code cleanups and tweaks Sergey Senozhatsky
@ 2026-12-01 9:06 ` Sergey Senozhatsky
2026-12-01 20:45 ` + zram-allocate-comp-only-if-it-is-supported.patch added to mm-new branch Andrew Morton
2026-12-01 9:06 ` [PATCH 2/7] zram: validate level before allocation in zstd_setup_params() Sergey Senozhatsky
` (5 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Sergey Senozhatsky @ 2026-12-01 9:06 UTC (permalink / raw)
To: Andrew Morton
Cc: Minchan Kim, Richard Chang, linux-kernel, linux-block, linux-mm,
Sergey Senozhatsky
Currently comp allocation happens before zram checks if
requested algorithm is even supported. Defer comp
allocation.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
drivers/block/zram/zcomp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index d05f3cbe6d9d..adf6d368ae6c 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -506,6 +506,7 @@ void zcomp_destroy(struct zcomp *comp)
struct zcomp *zcomp_create(const char *alg, struct zcomp_params *params,
bool recomp)
{
+ const struct zcomp_ops *ops;
struct zcomp *comp;
int error;
@@ -517,16 +518,15 @@ struct zcomp *zcomp_create(const char *alg, struct zcomp_params *params,
*/
BUILD_BUG_ON(ARRAY_SIZE(backends) <= 1);
+ ops = lookup_backend_ops(alg);
+ if (!ops)
+ return ERR_PTR(-EINVAL);
+
comp = kzalloc_obj(struct zcomp);
if (!comp)
return ERR_PTR(-ENOMEM);
- comp->ops = lookup_backend_ops(alg);
- if (!comp->ops) {
- kfree(comp);
- return ERR_PTR(-EINVAL);
- }
-
+ comp->ops = ops;
error = zcomp_init(comp, params, recomp);
if (error) {
kfree(comp);
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* + zram-allocate-comp-only-if-it-is-supported.patch added to mm-new branch
2026-12-01 9:06 ` [PATCH 1/7] zram: allocate comp only if it is supported Sergey Senozhatsky
@ 2026-12-01 20:45 ` Andrew Morton
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2026-12-01 20:45 UTC (permalink / raw)
To: mm-commits, richardycc, minchan, senozhatsky, akpm
The patch titled
Subject: zram: allocate comp only if it is supported
has been added to the -mm mm-new branch. Its filename is
zram-allocate-comp-only-if-it-is-supported.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-allocate-comp-only-if-it-is-supported.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: zram: allocate comp only if it is supported
Date: Tue, 01 Dec 2026 18:06:34 +0900
Patch series "zram: a set of trivial code cleanups and tweaks".
Trivial cleanups, like allocating memory only after params validation
succeeds, dropping some goto labels, etc. Most of these were spotted
during recent zcomp redesign work, but were not critical to the redesign
itself, so they are split out.
This patch (of 7):
Currently comp allocation happens before zram checks if requested
algorithm is even supported. Defer comp allocation.
Link: https://lore.kernel.org/20261201090703.1040645-1-senozhatsky@chromium.org
Link: https://patch.msgid.link/20261201090703.1040645-2-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
drivers/block/zram/zcomp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/drivers/block/zram/zcomp.c~zram-allocate-comp-only-if-it-is-supported
+++ a/drivers/block/zram/zcomp.c
@@ -506,6 +506,7 @@ void zcomp_destroy(struct zcomp *comp)
struct zcomp *zcomp_create(const char *alg, struct zcomp_params *params,
bool recomp)
{
+ const struct zcomp_ops *ops;
struct zcomp *comp;
int error;
@@ -517,16 +518,15 @@ struct zcomp *zcomp_create(const char *a
*/
BUILD_BUG_ON(ARRAY_SIZE(backends) <= 1);
+ ops = lookup_backend_ops(alg);
+ if (!ops)
+ return ERR_PTR(-EINVAL);
+
comp = kzalloc_obj(struct zcomp);
if (!comp)
return ERR_PTR(-ENOMEM);
- comp->ops = lookup_backend_ops(alg);
- if (!comp->ops) {
- kfree(comp);
- return ERR_PTR(-EINVAL);
- }
-
+ comp->ops = ops;
error = zcomp_init(comp, params, recomp);
if (error) {
kfree(comp);
_
Patches currently in -mm which might be from senozhatsky@chromium.org are
zram-prefix-backends-printk-s.patch
zram-remove-debugfs-entry-on-init-failure.patch
zram-reset-writeback-state-in-zram_reset_device.patch
zram-move-mark_slot_accessed-under-existing-slot-lock-sections.patch
zram-remove-stale-warn_on-from-zram_read_page.patch
zram-zstd-do-not-allocate-empty-c-d-dictionaries.patch
zram-lz4hc-pre-initialize-dictionary-stream-in-setup_params.patch
zram-lz4-use-lz4_decompress_safe_usingdict.patch
zram-lz4hc-use-lz4_decompress_safe_usingdict.patch
zram-zstd-do-not-use-kvzalloc-for-zstd-allocations.patch
zram-split-zcomp-into-separate-r-w-streams.patch
zram-introduce-shared-decompression-streams.patch
zram-allocate-bounce-buffer-for-spanning-objects.patch
zram-borrow-idle-decompression-streams-in-exclusive-mode.patch
zram-use-a-singleton-compression-context-for-recompression.patch
zram-drop-stale-comment-in-write_incompressible_page.patch
zram-drop-get_slot_handle-and-set_slot_handle.patch
zsmalloc-return-handle-from-obj_allocated.patch
zsmalloc-switch-handle-type-to-struct-zs_handle.patch
zram-check-mem_limit-before-allocating-zsmalloc-object.patch
zram-allocate-zsmalloc-object-under-slot-lock.patch
zswap-do-not-free-the-entry-if-its-pool-is-null.patch
zsmalloc-encode-1-based-obj_idx-so-valid-obj-is-never-0.patch
zsmalloc-embed-struct-zs_handle-into-zram-and-zswap-entries.patch
zsmalloc-fold-zs_obj_write-into-zs_store.patch
zsmalloc-populate-new-zspage-outside-class-lock-in-zs_store.patch
zram-fix-quadratic-writeback-bitmap-search.patch
zsmalloc-free-a-zspages-pages-in-one-batch.patch
zram-keep-the-hot-statistics-per-cpu.patch
zram-do-not-modify-cont-sysfs-store-buffers.patch
zram-avoid-rollback-uaf-in-zcomp_cpu_up_prepare.patch
zram-publish-streams-under-lock-in-zcomp_cpu_up_prepare.patch
zram-allocate-comp-only-if-it-is-supported.patch
zram-validate-level-before-allocation-in-zstd_setup_params.patch
zram-defer-wb_ctl-allocation-in-writeback_store.patch
zram-remove-out-label-in-recompress_store.patch
zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
zram-respect-80-cols-limit-in-zram_meta_alloc.patch
zram-rename-mark_idle-to-mark_slots_idle.patch
zsmalloc-fix-spdx-license-identifier.patch
zram-use-spdx-license-identifier.patch
maintainers-add-mm-and-block-lists-to-zram-entry.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/7] zram: validate level before allocation in zstd_setup_params()
2026-12-01 9:06 [PATCH 0/7] zram: a set of trivial code cleanups and tweaks Sergey Senozhatsky
2026-12-01 9:06 ` [PATCH 1/7] zram: allocate comp only if it is supported Sergey Senozhatsky
@ 2026-12-01 9:06 ` Sergey Senozhatsky
2026-12-01 20:45 ` + zram-validate-level-before-allocation-in-zstd_setup_params.patch added to mm-new branch Andrew Morton
2026-12-01 9:06 ` [PATCH 3/7] zram: defer wb_ctl allocation in writeback_store() Sergey Senozhatsky
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Sergey Senozhatsky @ 2026-12-01 9:06 UTC (permalink / raw)
To: Andrew Morton
Cc: Minchan Kim, Richard Chang, linux-kernel, linux-block, linux-mm,
Sergey Senozhatsky
zstd_setup_params() currently allocates ->drv_data before checking
params->level. Validate params->level before allocating zstd_params
and compute zstd_get_cparams() only when a dictionary is present,
so that we can drop the error label.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
drivers/block/zram/backend_zstd.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/block/zram/backend_zstd.c b/drivers/block/zram/backend_zstd.c
index d55615f34300..824174815ddf 100644
--- a/drivers/block/zram/backend_zstd.c
+++ b/drivers/block/zram/backend_zstd.c
@@ -60,47 +60,43 @@ static int zstd_setup_params(struct zcomp_params *params)
zstd_compression_parameters prm;
struct zstd_params *zp;
- zp = kzalloc_obj(*zp);
- if (!zp)
- return -ENOMEM;
-
- params->drv_data = zp;
if (params->level == ZCOMP_PARAM_NOT_SET) {
params->level = zstd_default_clevel();
} else if (params->level < zstd_min_clevel() ||
params->level > zstd_max_clevel()) {
pr_err("invalid compression level %d\n", params->level);
- goto error;
+ return -EINVAL;
}
+ zp = kzalloc_obj(*zp);
+ if (!zp)
+ return -ENOMEM;
+
+ params->drv_data = zp;
zp->cprm = zstd_get_params(params->level, PAGE_SIZE);
zp->custom_mem.customAlloc = zstd_custom_alloc;
zp->custom_mem.customFree = zstd_custom_free;
- prm = zstd_get_cparams(params->level, PAGE_SIZE,
- params->dict_sz);
-
if (!params->dict || !params->dict_sz)
return 0;
+ prm = zstd_get_cparams(params->level, PAGE_SIZE,
+ params->dict_sz);
zp->cdict = zstd_create_cdict_byreference(params->dict,
params->dict_sz,
prm,
zp->custom_mem);
if (!zp->cdict)
- goto error;
+ return -EINVAL;
zp->ddict = zstd_create_ddict_byreference(params->dict,
params->dict_sz,
zp->custom_mem);
if (!zp->ddict)
- goto error;
+ return -EINVAL;
return 0;
-
-error:
- return -EINVAL;
}
static void zstd_destroy_cctx(struct zcomp_ctx *ctx)
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* + zram-validate-level-before-allocation-in-zstd_setup_params.patch added to mm-new branch
2026-12-01 9:06 ` [PATCH 2/7] zram: validate level before allocation in zstd_setup_params() Sergey Senozhatsky
@ 2026-12-01 20:45 ` Andrew Morton
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2026-12-01 20:45 UTC (permalink / raw)
To: mm-commits, richardycc, minchan, senozhatsky, akpm
The patch titled
Subject: zram: validate level before allocation in zstd_setup_params()
has been added to the -mm mm-new branch. Its filename is
zram-validate-level-before-allocation-in-zstd_setup_params.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-validate-level-before-allocation-in-zstd_setup_params.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: zram: validate level before allocation in zstd_setup_params()
Date: Tue, 01 Dec 2026 18:06:35 +0900
zstd_setup_params() currently allocates ->drv_data before checking
params->level. Validate params->level before allocating zstd_params and
compute zstd_get_cparams() only when a dictionary is present, so that we
can drop the error label.
Link: https://patch.msgid.link/20261201090703.1040645-3-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
drivers/block/zram/backend_zstd.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
--- a/drivers/block/zram/backend_zstd.c~zram-validate-level-before-allocation-in-zstd_setup_params
+++ a/drivers/block/zram/backend_zstd.c
@@ -60,47 +60,43 @@ static int zstd_setup_params(struct zcom
zstd_compression_parameters prm;
struct zstd_params *zp;
- zp = kzalloc_obj(*zp);
- if (!zp)
- return -ENOMEM;
-
- params->drv_data = zp;
if (params->level == ZCOMP_PARAM_NOT_SET) {
params->level = zstd_default_clevel();
} else if (params->level < zstd_min_clevel() ||
params->level > zstd_max_clevel()) {
pr_err("invalid compression level %d\n", params->level);
- goto error;
+ return -EINVAL;
}
+ zp = kzalloc_obj(*zp);
+ if (!zp)
+ return -ENOMEM;
+
+ params->drv_data = zp;
zp->cprm = zstd_get_params(params->level, PAGE_SIZE);
zp->custom_mem.customAlloc = zstd_custom_alloc;
zp->custom_mem.customFree = zstd_custom_free;
- prm = zstd_get_cparams(params->level, PAGE_SIZE,
- params->dict_sz);
-
if (!params->dict || !params->dict_sz)
return 0;
+ prm = zstd_get_cparams(params->level, PAGE_SIZE,
+ params->dict_sz);
zp->cdict = zstd_create_cdict_byreference(params->dict,
params->dict_sz,
prm,
zp->custom_mem);
if (!zp->cdict)
- goto error;
+ return -EINVAL;
zp->ddict = zstd_create_ddict_byreference(params->dict,
params->dict_sz,
zp->custom_mem);
if (!zp->ddict)
- goto error;
+ return -EINVAL;
return 0;
-
-error:
- return -EINVAL;
}
static void zstd_destroy_cctx(struct zcomp_ctx *ctx)
_
Patches currently in -mm which might be from senozhatsky@chromium.org are
zram-prefix-backends-printk-s.patch
zram-remove-debugfs-entry-on-init-failure.patch
zram-reset-writeback-state-in-zram_reset_device.patch
zram-move-mark_slot_accessed-under-existing-slot-lock-sections.patch
zram-remove-stale-warn_on-from-zram_read_page.patch
zram-zstd-do-not-allocate-empty-c-d-dictionaries.patch
zram-lz4hc-pre-initialize-dictionary-stream-in-setup_params.patch
zram-lz4-use-lz4_decompress_safe_usingdict.patch
zram-lz4hc-use-lz4_decompress_safe_usingdict.patch
zram-zstd-do-not-use-kvzalloc-for-zstd-allocations.patch
zram-split-zcomp-into-separate-r-w-streams.patch
zram-introduce-shared-decompression-streams.patch
zram-allocate-bounce-buffer-for-spanning-objects.patch
zram-borrow-idle-decompression-streams-in-exclusive-mode.patch
zram-use-a-singleton-compression-context-for-recompression.patch
zram-drop-stale-comment-in-write_incompressible_page.patch
zram-drop-get_slot_handle-and-set_slot_handle.patch
zsmalloc-return-handle-from-obj_allocated.patch
zsmalloc-switch-handle-type-to-struct-zs_handle.patch
zram-check-mem_limit-before-allocating-zsmalloc-object.patch
zram-allocate-zsmalloc-object-under-slot-lock.patch
zswap-do-not-free-the-entry-if-its-pool-is-null.patch
zsmalloc-encode-1-based-obj_idx-so-valid-obj-is-never-0.patch
zsmalloc-embed-struct-zs_handle-into-zram-and-zswap-entries.patch
zsmalloc-fold-zs_obj_write-into-zs_store.patch
zsmalloc-populate-new-zspage-outside-class-lock-in-zs_store.patch
zram-fix-quadratic-writeback-bitmap-search.patch
zsmalloc-free-a-zspages-pages-in-one-batch.patch
zram-keep-the-hot-statistics-per-cpu.patch
zram-do-not-modify-cont-sysfs-store-buffers.patch
zram-avoid-rollback-uaf-in-zcomp_cpu_up_prepare.patch
zram-publish-streams-under-lock-in-zcomp_cpu_up_prepare.patch
zram-allocate-comp-only-if-it-is-supported.patch
zram-validate-level-before-allocation-in-zstd_setup_params.patch
zram-defer-wb_ctl-allocation-in-writeback_store.patch
zram-remove-out-label-in-recompress_store.patch
zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
zram-respect-80-cols-limit-in-zram_meta_alloc.patch
zram-rename-mark_idle-to-mark_slots_idle.patch
zsmalloc-fix-spdx-license-identifier.patch
zram-use-spdx-license-identifier.patch
maintainers-add-mm-and-block-lists-to-zram-entry.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/7] zram: defer wb_ctl allocation in writeback_store()
2026-12-01 9:06 [PATCH 0/7] zram: a set of trivial code cleanups and tweaks Sergey Senozhatsky
2026-12-01 9:06 ` [PATCH 1/7] zram: allocate comp only if it is supported Sergey Senozhatsky
2026-12-01 9:06 ` [PATCH 2/7] zram: validate level before allocation in zstd_setup_params() Sergey Senozhatsky
@ 2026-12-01 9:06 ` Sergey Senozhatsky
2026-12-01 20:45 ` + zram-defer-wb_ctl-allocation-in-writeback_store.patch added to mm-new branch Andrew Morton
2026-12-01 9:06 ` [PATCH 4/7] zram: remove out label in recompress_store() Sergey Senozhatsky
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Sergey Senozhatsky @ 2026-12-01 9:06 UTC (permalink / raw)
To: Andrew Morton
Cc: Minchan Kim, Richard Chang, linux-kernel, linux-block, linux-mm,
Sergey Senozhatsky
Defer wb_ctl allocation until writeback_store() has parsed and
validated its parameters.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
drivers/block/zram/zram_drv.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index ca12c1918aec..76778089b376 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1277,8 +1277,8 @@ static ssize_t writeback_store(struct device *dev,
struct zram *zram = dev_to_zram(dev);
unsigned long nr_pages;
unsigned long lo = 0, hi;
- struct zram_pp_ctl *pp_ctl = NULL;
- struct zram_wb_ctl *wb_ctl = NULL;
+ struct zram_pp_ctl *pp_ctl;
+ struct zram_wb_ctl *wb_ctl;
char *kbuf __free(kfree) = NULL;
char *args, *param, *val;
ssize_t ret = len;
@@ -1302,12 +1302,6 @@ static ssize_t writeback_store(struct device *dev,
if (!pp_ctl)
return -ENOMEM;
- wb_ctl = init_wb_ctl(zram);
- if (!wb_ctl) {
- ret = -ENOMEM;
- goto out;
- }
-
args = skip_spaces(kbuf);
while (*args) {
args = next_arg(args, ¶m, &val);
@@ -1370,13 +1364,19 @@ static ssize_t writeback_store(struct device *dev,
}
}
+ wb_ctl = init_wb_ctl(zram);
+ if (!wb_ctl) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
err = zram_writeback_slots(zram, pp_ctl, wb_ctl);
if (err)
ret = err;
+ release_wb_ctl(wb_ctl);
out:
release_pp_ctl(zram, pp_ctl);
- release_wb_ctl(wb_ctl);
return ret;
}
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* + zram-defer-wb_ctl-allocation-in-writeback_store.patch added to mm-new branch
2026-12-01 9:06 ` [PATCH 3/7] zram: defer wb_ctl allocation in writeback_store() Sergey Senozhatsky
@ 2026-12-01 20:45 ` Andrew Morton
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2026-12-01 20:45 UTC (permalink / raw)
To: mm-commits, richardycc, minchan, senozhatsky, akpm
The patch titled
Subject: zram: defer wb_ctl allocation in writeback_store()
has been added to the -mm mm-new branch. Its filename is
zram-defer-wb_ctl-allocation-in-writeback_store.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-defer-wb_ctl-allocation-in-writeback_store.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: zram: defer wb_ctl allocation in writeback_store()
Date: Tue, 01 Dec 2026 18:06:36 +0900
Defer wb_ctl allocation until writeback_store() has parsed and validated
its parameters.
Link: https://patch.msgid.link/20261201090703.1040645-4-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
drivers/block/zram/zram_drv.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--- a/drivers/block/zram/zram_drv.c~zram-defer-wb_ctl-allocation-in-writeback_store
+++ a/drivers/block/zram/zram_drv.c
@@ -1283,8 +1283,8 @@ static ssize_t writeback_store(struct de
struct zram *zram = dev_to_zram(dev);
unsigned long nr_pages;
unsigned long lo = 0, hi;
- struct zram_pp_ctl *pp_ctl = NULL;
- struct zram_wb_ctl *wb_ctl = NULL;
+ struct zram_pp_ctl *pp_ctl;
+ struct zram_wb_ctl *wb_ctl;
char *kbuf __free(kfree) = NULL;
char *args, *param, *val;
ssize_t ret = len;
@@ -1308,12 +1308,6 @@ static ssize_t writeback_store(struct de
if (!pp_ctl)
return -ENOMEM;
- wb_ctl = init_wb_ctl(zram);
- if (!wb_ctl) {
- ret = -ENOMEM;
- goto out;
- }
-
args = skip_spaces(kbuf);
while (*args) {
args = next_arg(args, ¶m, &val);
@@ -1376,13 +1370,19 @@ static ssize_t writeback_store(struct de
}
}
+ wb_ctl = init_wb_ctl(zram);
+ if (!wb_ctl) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
err = zram_writeback_slots(zram, pp_ctl, wb_ctl);
if (err)
ret = err;
+ release_wb_ctl(wb_ctl);
out:
release_pp_ctl(zram, pp_ctl);
- release_wb_ctl(wb_ctl);
return ret;
}
_
Patches currently in -mm which might be from senozhatsky@chromium.org are
zram-prefix-backends-printk-s.patch
zram-remove-debugfs-entry-on-init-failure.patch
zram-reset-writeback-state-in-zram_reset_device.patch
zram-move-mark_slot_accessed-under-existing-slot-lock-sections.patch
zram-remove-stale-warn_on-from-zram_read_page.patch
zram-zstd-do-not-allocate-empty-c-d-dictionaries.patch
zram-lz4hc-pre-initialize-dictionary-stream-in-setup_params.patch
zram-lz4-use-lz4_decompress_safe_usingdict.patch
zram-lz4hc-use-lz4_decompress_safe_usingdict.patch
zram-zstd-do-not-use-kvzalloc-for-zstd-allocations.patch
zram-split-zcomp-into-separate-r-w-streams.patch
zram-introduce-shared-decompression-streams.patch
zram-allocate-bounce-buffer-for-spanning-objects.patch
zram-borrow-idle-decompression-streams-in-exclusive-mode.patch
zram-use-a-singleton-compression-context-for-recompression.patch
zram-drop-stale-comment-in-write_incompressible_page.patch
zram-drop-get_slot_handle-and-set_slot_handle.patch
zsmalloc-return-handle-from-obj_allocated.patch
zsmalloc-switch-handle-type-to-struct-zs_handle.patch
zram-check-mem_limit-before-allocating-zsmalloc-object.patch
zram-allocate-zsmalloc-object-under-slot-lock.patch
zswap-do-not-free-the-entry-if-its-pool-is-null.patch
zsmalloc-encode-1-based-obj_idx-so-valid-obj-is-never-0.patch
zsmalloc-embed-struct-zs_handle-into-zram-and-zswap-entries.patch
zsmalloc-fold-zs_obj_write-into-zs_store.patch
zsmalloc-populate-new-zspage-outside-class-lock-in-zs_store.patch
zram-fix-quadratic-writeback-bitmap-search.patch
zsmalloc-free-a-zspages-pages-in-one-batch.patch
zram-keep-the-hot-statistics-per-cpu.patch
zram-do-not-modify-cont-sysfs-store-buffers.patch
zram-avoid-rollback-uaf-in-zcomp_cpu_up_prepare.patch
zram-publish-streams-under-lock-in-zcomp_cpu_up_prepare.patch
zram-allocate-comp-only-if-it-is-supported.patch
zram-validate-level-before-allocation-in-zstd_setup_params.patch
zram-defer-wb_ctl-allocation-in-writeback_store.patch
zram-remove-out-label-in-recompress_store.patch
zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
zram-respect-80-cols-limit-in-zram_meta_alloc.patch
zram-rename-mark_idle-to-mark_slots_idle.patch
zsmalloc-fix-spdx-license-identifier.patch
zram-use-spdx-license-identifier.patch
maintainers-add-mm-and-block-lists-to-zram-entry.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4/7] zram: remove out label in recompress_store()
2026-12-01 9:06 [PATCH 0/7] zram: a set of trivial code cleanups and tweaks Sergey Senozhatsky
` (2 preceding siblings ...)
2026-12-01 9:06 ` [PATCH 3/7] zram: defer wb_ctl allocation in writeback_store() Sergey Senozhatsky
@ 2026-12-01 9:06 ` Sergey Senozhatsky
2026-12-01 20:45 ` + zram-remove-out-label-in-recompress_store.patch added to mm-new branch Andrew Morton
2026-12-01 9:06 ` [PATCH 5/7] zram: create debugfs dir after register_blkdev() in zram_init() Sergey Senozhatsky
` (2 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Sergey Senozhatsky @ 2026-12-01 9:06 UTC (permalink / raw)
To: Andrew Morton
Cc: Minchan Kim, Richard Chang, linux-kernel, linux-block, linux-mm,
Sergey Senozhatsky
The only two jumps to the out label in recompress_store() are the
alloc_page() and init_pp_ctl() failure paths. Return directly on those
two paths instead and simplify the function return path.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
drivers/block/zram/zram_drv.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 76778089b376..9b9c21e6aebd 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -2594,11 +2594,11 @@ static ssize_t recompress_store(struct device *dev,
char *args, *param, *val, *algo = NULL;
u64 num_recomp_pages = ULLONG_MAX;
char *kbuf __free(kfree) = NULL;
- struct zram_pp_ctl *ctl = NULL;
+ struct zram_pp_ctl *ctl;
s32 prio = ZRAM_SECONDARY_COMP;
u32 mode = 0, threshold = 0;
struct zram_pp_slot *pps;
- struct page *page = NULL;
+ struct page *page;
bool prio_param = false;
ssize_t ret;
@@ -2689,15 +2689,13 @@ static ssize_t recompress_store(struct device *dev,
return -EINVAL;
page = alloc_page(GFP_KERNEL);
- if (!page) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!page)
+ return -ENOMEM;
ctl = init_pp_ctl();
if (!ctl) {
- ret = -ENOMEM;
- goto out;
+ __free_page(page);
+ return -ENOMEM;
}
scan_slots_for_recompress(zram, mode, prio, ctl);
@@ -2727,9 +2725,7 @@ static ssize_t recompress_store(struct device *dev,
cond_resched();
}
-out:
- if (page)
- __free_page(page);
+ __free_page(page);
release_pp_ctl(zram, ctl);
return ret;
}
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* + zram-remove-out-label-in-recompress_store.patch added to mm-new branch
2026-12-01 9:06 ` [PATCH 4/7] zram: remove out label in recompress_store() Sergey Senozhatsky
@ 2026-12-01 20:45 ` Andrew Morton
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2026-12-01 20:45 UTC (permalink / raw)
To: mm-commits, richardycc, minchan, senozhatsky, akpm
The patch titled
Subject: zram: remove out label in recompress_store()
has been added to the -mm mm-new branch. Its filename is
zram-remove-out-label-in-recompress_store.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-remove-out-label-in-recompress_store.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: zram: remove out label in recompress_store()
Date: Tue, 01 Dec 2026 18:06:37 +0900
The only two jumps to the out label in recompress_store() are the
alloc_page() and init_pp_ctl() failure paths. Return directly on those
two paths instead and simplify the function return path.
Link: https://patch.msgid.link/20261201090703.1040645-5-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
drivers/block/zram/zram_drv.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
--- a/drivers/block/zram/zram_drv.c~zram-remove-out-label-in-recompress_store
+++ a/drivers/block/zram/zram_drv.c
@@ -2600,11 +2600,11 @@ static ssize_t recompress_store(struct d
char *args, *param, *val, *algo = NULL;
u64 num_recomp_pages = ULLONG_MAX;
char *kbuf __free(kfree) = NULL;
- struct zram_pp_ctl *ctl = NULL;
+ struct zram_pp_ctl *ctl;
s32 prio = ZRAM_SECONDARY_COMP;
u32 mode = 0, threshold = 0;
struct zram_pp_slot *pps;
- struct page *page = NULL;
+ struct page *page;
bool prio_param = false;
ssize_t ret;
@@ -2695,15 +2695,13 @@ static ssize_t recompress_store(struct d
return -EINVAL;
page = alloc_page(GFP_KERNEL);
- if (!page) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!page)
+ return -ENOMEM;
ctl = init_pp_ctl();
if (!ctl) {
- ret = -ENOMEM;
- goto out;
+ __free_page(page);
+ return -ENOMEM;
}
scan_slots_for_recompress(zram, mode, prio, ctl);
@@ -2733,9 +2731,7 @@ next:
cond_resched();
}
-out:
- if (page)
- __free_page(page);
+ __free_page(page);
release_pp_ctl(zram, ctl);
return ret;
}
_
Patches currently in -mm which might be from senozhatsky@chromium.org are
zram-prefix-backends-printk-s.patch
zram-remove-debugfs-entry-on-init-failure.patch
zram-reset-writeback-state-in-zram_reset_device.patch
zram-move-mark_slot_accessed-under-existing-slot-lock-sections.patch
zram-remove-stale-warn_on-from-zram_read_page.patch
zram-zstd-do-not-allocate-empty-c-d-dictionaries.patch
zram-lz4hc-pre-initialize-dictionary-stream-in-setup_params.patch
zram-lz4-use-lz4_decompress_safe_usingdict.patch
zram-lz4hc-use-lz4_decompress_safe_usingdict.patch
zram-zstd-do-not-use-kvzalloc-for-zstd-allocations.patch
zram-split-zcomp-into-separate-r-w-streams.patch
zram-introduce-shared-decompression-streams.patch
zram-allocate-bounce-buffer-for-spanning-objects.patch
zram-borrow-idle-decompression-streams-in-exclusive-mode.patch
zram-use-a-singleton-compression-context-for-recompression.patch
zram-drop-stale-comment-in-write_incompressible_page.patch
zram-drop-get_slot_handle-and-set_slot_handle.patch
zsmalloc-return-handle-from-obj_allocated.patch
zsmalloc-switch-handle-type-to-struct-zs_handle.patch
zram-check-mem_limit-before-allocating-zsmalloc-object.patch
zram-allocate-zsmalloc-object-under-slot-lock.patch
zswap-do-not-free-the-entry-if-its-pool-is-null.patch
zsmalloc-encode-1-based-obj_idx-so-valid-obj-is-never-0.patch
zsmalloc-embed-struct-zs_handle-into-zram-and-zswap-entries.patch
zsmalloc-fold-zs_obj_write-into-zs_store.patch
zsmalloc-populate-new-zspage-outside-class-lock-in-zs_store.patch
zram-fix-quadratic-writeback-bitmap-search.patch
zsmalloc-free-a-zspages-pages-in-one-batch.patch
zram-keep-the-hot-statistics-per-cpu.patch
zram-do-not-modify-cont-sysfs-store-buffers.patch
zram-avoid-rollback-uaf-in-zcomp_cpu_up_prepare.patch
zram-publish-streams-under-lock-in-zcomp_cpu_up_prepare.patch
zram-allocate-comp-only-if-it-is-supported.patch
zram-validate-level-before-allocation-in-zstd_setup_params.patch
zram-defer-wb_ctl-allocation-in-writeback_store.patch
zram-remove-out-label-in-recompress_store.patch
zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
zram-respect-80-cols-limit-in-zram_meta_alloc.patch
zram-rename-mark_idle-to-mark_slots_idle.patch
zsmalloc-fix-spdx-license-identifier.patch
zram-use-spdx-license-identifier.patch
maintainers-add-mm-and-block-lists-to-zram-entry.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5/7] zram: create debugfs dir after register_blkdev() in zram_init()
2026-12-01 9:06 [PATCH 0/7] zram: a set of trivial code cleanups and tweaks Sergey Senozhatsky
` (3 preceding siblings ...)
2026-12-01 9:06 ` [PATCH 4/7] zram: remove out label in recompress_store() Sergey Senozhatsky
@ 2026-12-01 9:06 ` Sergey Senozhatsky
2026-12-01 20:45 ` + zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch added to mm-new branch Andrew Morton
2026-12-01 9:06 ` [PATCH 6/7] zram: respect 80-cols limit in zram_meta_alloc() Sergey Senozhatsky
2026-12-01 9:06 ` [PATCH 7/7] zram: rename mark_idle() to mark_slots_idle() Sergey Senozhatsky
6 siblings, 1 reply; 15+ messages in thread
From: Sergey Senozhatsky @ 2026-12-01 9:06 UTC (permalink / raw)
To: Andrew Morton
Cc: Minchan Kim, Richard Chang, linux-kernel, linux-block, linux-mm,
Sergey Senozhatsky
Move zram_debugfs_create() after register_blkdev() to slightly
simplify error handling.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
drivers/block/zram/zram_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 9b9c21e6aebd..3a6360e1a5a0 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -3339,16 +3339,16 @@ static int __init zram_init(void)
return ret;
}
- zram_debugfs_create();
zram_major = register_blkdev(0, "zram");
if (zram_major <= 0) {
pr_err("Unable to get major number\n");
class_unregister(&zram_control_class);
- zram_debugfs_destroy();
cpuhp_remove_multi_state(CPUHP_ZCOMP_PREPARE);
return -EBUSY;
}
+ zram_debugfs_create();
+
while (num_devices != 0) {
mutex_lock(&zram_index_mutex);
ret = zram_add();
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* + zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch added to mm-new branch
2026-12-01 9:06 ` [PATCH 5/7] zram: create debugfs dir after register_blkdev() in zram_init() Sergey Senozhatsky
@ 2026-12-01 20:45 ` Andrew Morton
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2026-12-01 20:45 UTC (permalink / raw)
To: mm-commits, richardycc, minchan, senozhatsky, akpm
The patch titled
Subject: zram: create debugfs dir after register_blkdev() in zram_init()
has been added to the -mm mm-new branch. Its filename is
zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: zram: create debugfs dir after register_blkdev() in zram_init()
Date: Tue, 01 Dec 2026 18:06:38 +0900
Move zram_debugfs_create() after register_blkdev() to slightly simplify
error handling.
Link: https://patch.msgid.link/20261201090703.1040645-6-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
drivers/block/zram/zram_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/block/zram/zram_drv.c~zram-create-debugfs-dir-after-register_blkdev-in-zram_init
+++ a/drivers/block/zram/zram_drv.c
@@ -3345,16 +3345,16 @@ static int __init zram_init(void)
return ret;
}
- zram_debugfs_create();
zram_major = register_blkdev(0, "zram");
if (zram_major <= 0) {
pr_err("Unable to get major number\n");
class_unregister(&zram_control_class);
- zram_debugfs_destroy();
cpuhp_remove_multi_state(CPUHP_ZCOMP_PREPARE);
return -EBUSY;
}
+ zram_debugfs_create();
+
while (num_devices != 0) {
mutex_lock(&zram_index_mutex);
ret = zram_add();
_
Patches currently in -mm which might be from senozhatsky@chromium.org are
zram-prefix-backends-printk-s.patch
zram-remove-debugfs-entry-on-init-failure.patch
zram-reset-writeback-state-in-zram_reset_device.patch
zram-move-mark_slot_accessed-under-existing-slot-lock-sections.patch
zram-remove-stale-warn_on-from-zram_read_page.patch
zram-zstd-do-not-allocate-empty-c-d-dictionaries.patch
zram-lz4hc-pre-initialize-dictionary-stream-in-setup_params.patch
zram-lz4-use-lz4_decompress_safe_usingdict.patch
zram-lz4hc-use-lz4_decompress_safe_usingdict.patch
zram-zstd-do-not-use-kvzalloc-for-zstd-allocations.patch
zram-split-zcomp-into-separate-r-w-streams.patch
zram-introduce-shared-decompression-streams.patch
zram-allocate-bounce-buffer-for-spanning-objects.patch
zram-borrow-idle-decompression-streams-in-exclusive-mode.patch
zram-use-a-singleton-compression-context-for-recompression.patch
zram-drop-stale-comment-in-write_incompressible_page.patch
zram-drop-get_slot_handle-and-set_slot_handle.patch
zsmalloc-return-handle-from-obj_allocated.patch
zsmalloc-switch-handle-type-to-struct-zs_handle.patch
zram-check-mem_limit-before-allocating-zsmalloc-object.patch
zram-allocate-zsmalloc-object-under-slot-lock.patch
zswap-do-not-free-the-entry-if-its-pool-is-null.patch
zsmalloc-encode-1-based-obj_idx-so-valid-obj-is-never-0.patch
zsmalloc-embed-struct-zs_handle-into-zram-and-zswap-entries.patch
zsmalloc-fold-zs_obj_write-into-zs_store.patch
zsmalloc-populate-new-zspage-outside-class-lock-in-zs_store.patch
zram-fix-quadratic-writeback-bitmap-search.patch
zsmalloc-free-a-zspages-pages-in-one-batch.patch
zram-keep-the-hot-statistics-per-cpu.patch
zram-do-not-modify-cont-sysfs-store-buffers.patch
zram-avoid-rollback-uaf-in-zcomp_cpu_up_prepare.patch
zram-publish-streams-under-lock-in-zcomp_cpu_up_prepare.patch
zram-allocate-comp-only-if-it-is-supported.patch
zram-validate-level-before-allocation-in-zstd_setup_params.patch
zram-defer-wb_ctl-allocation-in-writeback_store.patch
zram-remove-out-label-in-recompress_store.patch
zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
zram-respect-80-cols-limit-in-zram_meta_alloc.patch
zram-rename-mark_idle-to-mark_slots_idle.patch
zsmalloc-fix-spdx-license-identifier.patch
zram-use-spdx-license-identifier.patch
maintainers-add-mm-and-block-lists-to-zram-entry.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 6/7] zram: respect 80-cols limit in zram_meta_alloc()
2026-12-01 9:06 [PATCH 0/7] zram: a set of trivial code cleanups and tweaks Sergey Senozhatsky
` (4 preceding siblings ...)
2026-12-01 9:06 ` [PATCH 5/7] zram: create debugfs dir after register_blkdev() in zram_init() Sergey Senozhatsky
@ 2026-12-01 9:06 ` Sergey Senozhatsky
2026-12-01 20:45 ` + zram-respect-80-cols-limit-in-zram_meta_alloc.patch added to mm-new branch Andrew Morton
2026-12-01 9:06 ` [PATCH 7/7] zram: rename mark_idle() to mark_slots_idle() Sergey Senozhatsky
6 siblings, 1 reply; 15+ messages in thread
From: Sergey Senozhatsky @ 2026-12-01 9:06 UTC (permalink / raw)
To: Andrew Morton
Cc: Minchan Kim, Richard Chang, linux-kernel, linux-block, linux-mm,
Sergey Senozhatsky
Make lockdep_init_map() call follow the 80-cols limit.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
drivers/block/zram/zram_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 3a6360e1a5a0..6a48f11b26c0 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -2069,7 +2069,8 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
huge_class_size = zs_huge_class_size(zram->mem_pool);
lockdep_register_key(&zram->table_lock_key);
- lockdep_init_map(&zram->table_lock_map, "zram->table[index].lock", &zram->table_lock_key, 0);
+ lockdep_init_map(&zram->table_lock_map, "zram->table[index].lock",
+ &zram->table_lock_key, 0);
return true;
}
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* + zram-respect-80-cols-limit-in-zram_meta_alloc.patch added to mm-new branch
2026-12-01 9:06 ` [PATCH 6/7] zram: respect 80-cols limit in zram_meta_alloc() Sergey Senozhatsky
@ 2026-12-01 20:45 ` Andrew Morton
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2026-12-01 20:45 UTC (permalink / raw)
To: mm-commits, richardycc, minchan, senozhatsky, akpm
The patch titled
Subject: zram: respect 80-cols limit in zram_meta_alloc()
has been added to the -mm mm-new branch. Its filename is
zram-respect-80-cols-limit-in-zram_meta_alloc.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-respect-80-cols-limit-in-zram_meta_alloc.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: zram: respect 80-cols limit in zram_meta_alloc()
Date: Tue, 01 Dec 2026 18:06:39 +0900
Make lockdep_init_map() call follow the 80-cols limit.
Link: https://patch.msgid.link/20261201090703.1040645-7-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
drivers/block/zram/zram_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/block/zram/zram_drv.c~zram-respect-80-cols-limit-in-zram_meta_alloc
+++ a/drivers/block/zram/zram_drv.c
@@ -2075,7 +2075,8 @@ static bool zram_meta_alloc(struct zram
huge_class_size = zs_huge_class_size(zram->mem_pool);
lockdep_register_key(&zram->table_lock_key);
- lockdep_init_map(&zram->table_lock_map, "zram->table[index].lock", &zram->table_lock_key, 0);
+ lockdep_init_map(&zram->table_lock_map, "zram->table[index].lock",
+ &zram->table_lock_key, 0);
return true;
}
_
Patches currently in -mm which might be from senozhatsky@chromium.org are
zram-prefix-backends-printk-s.patch
zram-remove-debugfs-entry-on-init-failure.patch
zram-reset-writeback-state-in-zram_reset_device.patch
zram-move-mark_slot_accessed-under-existing-slot-lock-sections.patch
zram-remove-stale-warn_on-from-zram_read_page.patch
zram-zstd-do-not-allocate-empty-c-d-dictionaries.patch
zram-lz4hc-pre-initialize-dictionary-stream-in-setup_params.patch
zram-lz4-use-lz4_decompress_safe_usingdict.patch
zram-lz4hc-use-lz4_decompress_safe_usingdict.patch
zram-zstd-do-not-use-kvzalloc-for-zstd-allocations.patch
zram-split-zcomp-into-separate-r-w-streams.patch
zram-introduce-shared-decompression-streams.patch
zram-allocate-bounce-buffer-for-spanning-objects.patch
zram-borrow-idle-decompression-streams-in-exclusive-mode.patch
zram-use-a-singleton-compression-context-for-recompression.patch
zram-drop-stale-comment-in-write_incompressible_page.patch
zram-drop-get_slot_handle-and-set_slot_handle.patch
zsmalloc-return-handle-from-obj_allocated.patch
zsmalloc-switch-handle-type-to-struct-zs_handle.patch
zram-check-mem_limit-before-allocating-zsmalloc-object.patch
zram-allocate-zsmalloc-object-under-slot-lock.patch
zswap-do-not-free-the-entry-if-its-pool-is-null.patch
zsmalloc-encode-1-based-obj_idx-so-valid-obj-is-never-0.patch
zsmalloc-embed-struct-zs_handle-into-zram-and-zswap-entries.patch
zsmalloc-fold-zs_obj_write-into-zs_store.patch
zsmalloc-populate-new-zspage-outside-class-lock-in-zs_store.patch
zram-fix-quadratic-writeback-bitmap-search.patch
zsmalloc-free-a-zspages-pages-in-one-batch.patch
zram-keep-the-hot-statistics-per-cpu.patch
zram-do-not-modify-cont-sysfs-store-buffers.patch
zram-avoid-rollback-uaf-in-zcomp_cpu_up_prepare.patch
zram-publish-streams-under-lock-in-zcomp_cpu_up_prepare.patch
zram-allocate-comp-only-if-it-is-supported.patch
zram-validate-level-before-allocation-in-zstd_setup_params.patch
zram-defer-wb_ctl-allocation-in-writeback_store.patch
zram-remove-out-label-in-recompress_store.patch
zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
zram-respect-80-cols-limit-in-zram_meta_alloc.patch
zram-rename-mark_idle-to-mark_slots_idle.patch
zsmalloc-fix-spdx-license-identifier.patch
zram-use-spdx-license-identifier.patch
maintainers-add-mm-and-block-lists-to-zram-entry.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 7/7] zram: rename mark_idle() to mark_slots_idle()
2026-12-01 9:06 [PATCH 0/7] zram: a set of trivial code cleanups and tweaks Sergey Senozhatsky
` (5 preceding siblings ...)
2026-12-01 9:06 ` [PATCH 6/7] zram: respect 80-cols limit in zram_meta_alloc() Sergey Senozhatsky
@ 2026-12-01 9:06 ` Sergey Senozhatsky
2026-12-01 20:45 ` + zram-rename-mark_idle-to-mark_slots_idle.patch added to mm-new branch Andrew Morton
6 siblings, 1 reply; 15+ messages in thread
From: Sergey Senozhatsky @ 2026-12-01 9:06 UTC (permalink / raw)
To: Andrew Morton
Cc: Minchan Kim, Richard Chang, linux-kernel, linux-block, linux-mm,
Sergey Senozhatsky
Rename mark_idle() to mark_slots_idle() so that its naming
follows current zram conventions: mark_slot_accessed(),
set_slot_flag(), etc.
While at it, fix up the comments (there is no init lock
anymore, and the cutoff check has always been strict)
and make trivial coding style tweaks.
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
drivers/block/zram/zram_drv.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 6a48f11b26c0..36873b655d66 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -429,10 +429,10 @@ static ssize_t mem_used_max_store(struct device *dev,
}
/*
- * Mark all pages which are older than or equal to cutoff as IDLE.
- * Callers should hold the zram init lock in read mode
+ * Mark all slots which are older than cutoff as IDLE.
+ * Callers should hold the zram dev lock in read mode
*/
-static void mark_idle(struct zram *zram, time64_t cutoff)
+static void mark_slots_idle(struct zram *zram, time64_t cutoff)
{
int is_idle = 1;
unsigned long nr_pages = zram->disksize >> PAGE_SHIFT;
@@ -455,8 +455,7 @@ static void mark_idle(struct zram *zram, time64_t cutoff)
}
#ifdef CONFIG_ZRAM_TRACK_ENTRY_ACTIME
- is_idle = !cutoff ||
- cutoff > zram->table[index].attr.ac_time;
+ is_idle = !cutoff || cutoff > zram->table[index].attr.ac_time;
#endif
if (is_idle)
set_slot_flag(zram, index, ZRAM_IDLE);
@@ -497,10 +496,9 @@ static ssize_t idle_store(struct device *dev, struct device_attribute *attr,
return -EINVAL;
/*
- * A cutoff of 0 marks everything as idle, this is the
- * "all" behavior.
+ * A cutoff of 0 marks everything as idle, this is the "all" behavior.
*/
- mark_idle(zram, cutoff);
+ mark_slots_idle(zram, cutoff);
return len;
}
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* + zram-rename-mark_idle-to-mark_slots_idle.patch added to mm-new branch
2026-12-01 9:06 ` [PATCH 7/7] zram: rename mark_idle() to mark_slots_idle() Sergey Senozhatsky
@ 2026-12-01 20:45 ` Andrew Morton
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2026-12-01 20:45 UTC (permalink / raw)
To: mm-commits, richardycc, minchan, senozhatsky, akpm
The patch titled
Subject: zram: rename mark_idle() to mark_slots_idle()
has been added to the -mm mm-new branch. Its filename is
zram-rename-mark_idle-to-mark_slots_idle.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-rename-mark_idle-to-mark_slots_idle.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: zram: rename mark_idle() to mark_slots_idle()
Date: Tue, 01 Dec 2026 18:06:40 +0900
Rename mark_idle() to mark_slots_idle() so that its naming follows current
zram conventions: mark_slot_accessed(), set_slot_flag(), etc.
While at it, fix up the comments (there is no init lock anymore, and the
cutoff check has always been strict) and make trivial coding style tweaks.
Link: https://patch.msgid.link/20261201090703.1040645-8-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Richard Chang <richardycc@google.com>
drivers/block/zram/zram_drv.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
--- a/drivers/block/zram/zram_drv.c~zram-rename-mark_idle-to-mark_slots_idle
+++ a/drivers/block/zram/zram_drv.c
@@ -435,10 +435,10 @@ static ssize_t mem_used_max_store(struct
}
/*
- * Mark all pages which are older than or equal to cutoff as IDLE.
- * Callers should hold the zram init lock in read mode
+ * Mark all slots which are older than cutoff as IDLE.
+ * Callers should hold the zram dev lock in read mode
*/
-static void mark_idle(struct zram *zram, time64_t cutoff)
+static void mark_slots_idle(struct zram *zram, time64_t cutoff)
{
int is_idle = 1;
unsigned long nr_pages = zram->disksize >> PAGE_SHIFT;
@@ -461,8 +461,7 @@ static void mark_idle(struct zram *zram,
}
#ifdef CONFIG_ZRAM_TRACK_ENTRY_ACTIME
- is_idle = !cutoff ||
- cutoff > zram->table[index].attr.ac_time;
+ is_idle = !cutoff || cutoff > zram->table[index].attr.ac_time;
#endif
if (is_idle)
set_slot_flag(zram, index, ZRAM_IDLE);
@@ -503,10 +502,9 @@ static ssize_t idle_store(struct device
return -EINVAL;
/*
- * A cutoff of 0 marks everything as idle, this is the
- * "all" behavior.
+ * A cutoff of 0 marks everything as idle, this is the "all" behavior.
*/
- mark_idle(zram, cutoff);
+ mark_slots_idle(zram, cutoff);
return len;
}
_
Patches currently in -mm which might be from senozhatsky@chromium.org are
zram-prefix-backends-printk-s.patch
zram-remove-debugfs-entry-on-init-failure.patch
zram-reset-writeback-state-in-zram_reset_device.patch
zram-move-mark_slot_accessed-under-existing-slot-lock-sections.patch
zram-remove-stale-warn_on-from-zram_read_page.patch
zram-zstd-do-not-allocate-empty-c-d-dictionaries.patch
zram-lz4hc-pre-initialize-dictionary-stream-in-setup_params.patch
zram-lz4-use-lz4_decompress_safe_usingdict.patch
zram-lz4hc-use-lz4_decompress_safe_usingdict.patch
zram-zstd-do-not-use-kvzalloc-for-zstd-allocations.patch
zram-split-zcomp-into-separate-r-w-streams.patch
zram-introduce-shared-decompression-streams.patch
zram-allocate-bounce-buffer-for-spanning-objects.patch
zram-borrow-idle-decompression-streams-in-exclusive-mode.patch
zram-use-a-singleton-compression-context-for-recompression.patch
zram-drop-stale-comment-in-write_incompressible_page.patch
zram-drop-get_slot_handle-and-set_slot_handle.patch
zsmalloc-return-handle-from-obj_allocated.patch
zsmalloc-switch-handle-type-to-struct-zs_handle.patch
zram-check-mem_limit-before-allocating-zsmalloc-object.patch
zram-allocate-zsmalloc-object-under-slot-lock.patch
zswap-do-not-free-the-entry-if-its-pool-is-null.patch
zsmalloc-encode-1-based-obj_idx-so-valid-obj-is-never-0.patch
zsmalloc-embed-struct-zs_handle-into-zram-and-zswap-entries.patch
zsmalloc-fold-zs_obj_write-into-zs_store.patch
zsmalloc-populate-new-zspage-outside-class-lock-in-zs_store.patch
zram-fix-quadratic-writeback-bitmap-search.patch
zsmalloc-free-a-zspages-pages-in-one-batch.patch
zram-keep-the-hot-statistics-per-cpu.patch
zram-do-not-modify-cont-sysfs-store-buffers.patch
zram-avoid-rollback-uaf-in-zcomp_cpu_up_prepare.patch
zram-publish-streams-under-lock-in-zcomp_cpu_up_prepare.patch
zram-allocate-comp-only-if-it-is-supported.patch
zram-validate-level-before-allocation-in-zstd_setup_params.patch
zram-defer-wb_ctl-allocation-in-writeback_store.patch
zram-remove-out-label-in-recompress_store.patch
zram-create-debugfs-dir-after-register_blkdev-in-zram_init.patch
zram-respect-80-cols-limit-in-zram_meta_alloc.patch
zram-rename-mark_idle-to-mark_slots_idle.patch
zsmalloc-fix-spdx-license-identifier.patch
zram-use-spdx-license-identifier.patch
maintainers-add-mm-and-block-lists-to-zram-entry.patch
^ permalink raw reply [flat|nested] 15+ messages in thread