+ zram-move-comp-allocation-out-of-init_lock.patch added to -mm tree
Subsystems (2)
Subject: + zram-move-comp-allocation-out-of-init_lock.patch added to -mm tree
To: [email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 04 Mar 2014 12:35:35 -0800
The patch titled
Subject: zram: move comp allocation out of init_lock
has been added to the -mm tree. Its filename is
zram-move-comp-allocation-out-of-init_lock.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/zram-move-comp-allocation-out-of-init_lock.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/zram-move-comp-allocation-out-of-init_lock.patch
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/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Sergey Senozhatsky <[email protected]>
Subject: zram: move comp allocation out of init_lock
While fixing lockdep spew of ->init_lock reported by Sasha Levin [1], Minchan Kim noted [2] that it's better to move compression backend allocation (using GPF_KERNEL) out of the ->init_lock lock, same way as with zram_meta_alloc(), in order to prevent the same lockdep spew.
[1] https://lkml.org/lkml/2014/2/27/337
[2] https://lkml.org/lkml/2014/3/3/32
---
drivers/block/zram/zram_drv.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/block/zram/zram_drv.c renamed from drivers/block/zram/zram_drv.c~zram-move-comp-allocation-out-of-init_lock +15 -12
@@ -580,9 +580,10 @@ static ssize_t disksize_store(struct dev struct device_attribute *attr, const char *buf, size_t len) { u64 disksize; +struct zcomp *comp;struct zram_meta *meta;struct zram *zram =dev_to_zram (dev); -int err; +int err = -EINVAL ; disksize =memparse (buf,NULL );if (!disksize)
@@ -593,30 +594,32 @@ static ssize_t disksize_store(struct devif (!meta)return -ENOMEM ; + comp =zcomp_create (zram->compressor, zram->max_comp_streams); +if (!comp) { +pr_info ("Cannot initialise %s compressing backend\n" , + zram->compressor); + goto out_cleanup; + } +down_write (&zram->init_lock);if (init_done (zram)) { +up_write (&zram->init_lock);pr_info ("Cannot change disksize for initialized device\n" ); err = -EBUSY ; - goto out_free_meta; - } - - zram->comp =zcomp_create (zram->compressor, zram->max_comp_streams); -if (!zram->comp) { -pr_info ("Cannot initialise %s compressing backend\n" , - zram->compressor); - err = -EINVAL ; - goto out_free_meta; + goto out_cleanup; } zram->meta = meta; + zram->comp = comp; zram->disksize = disksize;set_capacity (zram->disk, zram->disksize >>SECTOR_SHIFT );up_write (&zram->init_lock);return len; -out_free_meta: -up_write (&zram->init_lock); +out_cleanup: +if (comp) +zcomp_destroy (comp);zram_meta_free (meta);return err; }
_
Patches currently in -mm which might be from [email protected] are
zram-drop-init_done-struct-zram-member.patch zram-do-not-pass-rw-argument-to-__zram_make_request.patch zram-remove-good-and-bad-compress-stats.patch zram-use-atomic64_t-for-all-zram-stats.patch zram-remove-zram-stats-code-duplication.patch zram-report-failed-read-and-write-stats.patch zram-drop-not-used-table-count-member.patch zram-move-zram-size-warning-to-documentation.patch zram-document-failed_reads-failed_writes-stats.patch zram-delete-zram_init_device.patch zram-delete-zram_init_device-fix.patch zram-introduce-compressing-backend-abstraction.patch zram-use-zcomp-compressing-backends.patch zram-use-zcomp-compressing-backends-fix.patch zram-factor-out-single-stream-compression.patch zram-add-multi-stream-functionality.patch zram-add-set_max_streams-knob.patch zram-make-compression-algorithm-selection-possible.patch zram-add-lz4-algorithm-backend.patch zram-move-comp-allocation-out-of-init_lock.patch