diff options
| author | Olav Haugan <ohaugan@codeaurora.org> | 2014-10-24 08:52:18 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:12:22 -0700 |
| commit | 81df3cf70bfc9bb1e1174ebc9ee68d1bb4bf9e82 (patch) | |
| tree | 5d2177e698be646bec1a4b42db21ff609e7290da | |
| parent | d722a1a4e907a4ad177d8e89d16384fe6ed24907 (diff) | |
staging: zram: Rate limit memory allocation errors
If an error occurs allocating memory for zram we will not be able to
fullfill the request to store the page in zram. The swap subsystem still
continues to try to swap out pages to zram even when this error occurs
since there is currently no facility to stop the swap subsystem from
swapping out during such errors. This can cause the system to be
overflowed with logging errors.
Reduce the amount of logging to prevent the kernel log from being filled
with these error messages
Change-Id: I54b920337749ece59d9ca78fa8b29345ec7b976b
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
| -rw-r--r-- | drivers/block/zram/zram_drv.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 2d67680a9afc..d6bff78ce8da 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -656,6 +656,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, struct zram_meta *meta = zram->meta; struct zcomp_strm *zstrm = NULL; unsigned long alloced_pages; + static unsigned long zram_rs_time; page = bvec->bv_page; if (is_partial_io(bvec)) { @@ -719,8 +720,11 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, handle = zs_malloc(meta->mem_pool, clen); if (!handle) { - pr_err("Error allocating memory for compressed page: %u, size=%zu\n", - index, clen); + if (printk_timed_ratelimit(&zram_rs_time, + ALLOC_ERROR_LOG_RATE_MS)) + pr_info("Error allocating memory for compressed page: %u, size=%zu\n", + index, clen); + ret = -ENOMEM; goto out; } |
