diff options
author | Anton Blanchard <anton@samba.org> | 2011-11-02 17:56:22 -0400 |
---|---|---|
committer | Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com> | 2011-11-21 12:55:13 -0500 |
commit | 9fd1ab0239852441ba8fdf5effd548ac407a6058 (patch) | |
tree | 25f626bec5150ec68e84989f63c37b8384cbf1cb | |
parent | 712f248a5b7438bf003644a1cc0dfeed4bbbc8fd (diff) |
Fix block queue and elevator memory leak in scsi_alloc_sdev
BugLink: http://bugs.launchpad.net/bugs/890952
commit f7c9c6bb14f3104608a3a83cadea10a6943d2804 upstream.
When looking at memory consumption issues I noticed quite a
lot of memory in the kmalloc-2048 bucket:
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
6561 6471 98% 2.30K 243 27 15552K kmalloc-2048
Over 15MB. slub debug shows that cfq is responsible for almost
all of it:
# sort -nr /sys/kernel/slab/kmalloc-2048/alloc_calls
6402 .cfq_init_queue+0xec/0x460 age=43423/43564/43655 pid=1 cpus=4,11,13
In scsi_alloc_sdev we do scsi_alloc_queue but if slave_alloc
fails we don't free it with scsi_free_queue.
The patch below fixes the issue:
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
135 72 53% 2.30K 5 27 320K kmalloc-2048
# cat /sys/kernel/slab/kmalloc-2048/alloc_calls
3 .cfq_init_queue+0xec/0x460 age=3811/3876/3925 pid=1 cpus=4,11,13
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
-rw-r--r-- | drivers/scsi/scsi_scan.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 44e8ca398ef..72273a0e566 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -322,6 +322,7 @@ out_device_destroy: | |||
322 | scsi_device_set_state(sdev, SDEV_DEL); | 322 | scsi_device_set_state(sdev, SDEV_DEL); |
323 | transport_destroy_device(&sdev->sdev_gendev); | 323 | transport_destroy_device(&sdev->sdev_gendev); |
324 | put_device(&sdev->sdev_dev); | 324 | put_device(&sdev->sdev_dev); |
325 | scsi_free_queue(sdev->request_queue); | ||
325 | put_device(&sdev->sdev_gendev); | 326 | put_device(&sdev->sdev_gendev); |
326 | out: | 327 | out: |
327 | if (display_failure_msg) | 328 | if (display_failure_msg) |