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>
This commit is contained in:
parent
d722a1a4e9
commit
81df3cf70b
1 changed files with 6 additions and 2 deletions
|
@ -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 zram_meta *meta = zram->meta;
|
||||||
struct zcomp_strm *zstrm = NULL;
|
struct zcomp_strm *zstrm = NULL;
|
||||||
unsigned long alloced_pages;
|
unsigned long alloced_pages;
|
||||||
|
static unsigned long zram_rs_time;
|
||||||
|
|
||||||
page = bvec->bv_page;
|
page = bvec->bv_page;
|
||||||
if (is_partial_io(bvec)) {
|
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);
|
handle = zs_malloc(meta->mem_pool, clen);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
pr_err("Error allocating memory for compressed page: %u, size=%zu\n",
|
if (printk_timed_ratelimit(&zram_rs_time,
|
||||||
index, clen);
|
ALLOC_ERROR_LOG_RATE_MS))
|
||||||
|
pr_info("Error allocating memory for compressed page: %u, size=%zu\n",
|
||||||
|
index, clen);
|
||||||
|
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue