Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6249f92f authored by Rohit Vaswani's avatar Rohit Vaswani
Browse files

mm: page_io: Rate limit swap read/write errors



Commit 6ddab3b9 ("mm: swap write failure fixup") added a warning
on swap read/write errors as they were failing silently earlier.
These failures do not cause any data corruption, but 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: I6910e6d3aeca5882ae07a40f1c702d4bc7e1158b
Signed-off-by: default avatarRohit Vaswani <rvaswani@codeaurora.org>
parent 718b9859
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -22,8 +22,12 @@
#include <linux/frontswap.h>
#include <linux/aio.h>
#include <linux/blkdev.h>
#include <linux/ratelimit.h>
#include <asm/pgtable.h>

#define ERROR_LOG_RATE_MS 1000
static unsigned long error_time;

static struct bio *get_swap_bio(gfp_t gfp_flags,
				struct page *page, bio_end_io_t end_io)
{
@@ -59,7 +63,8 @@ void end_swap_bio_write(struct bio *bio, int err)
		 * Also clear PG_reclaim to avoid rotate_reclaimable_page()
		 */
		set_page_dirty(page);
		printk(KERN_ALERT "Write-error on swap-device (%u:%u:%Lu)\n",
		if (printk_timed_ratelimit(&error_time, ERROR_LOG_RATE_MS))
			pr_info("Write-error on swap-device (%u:%u:%llu)\n",
				imajor(bio->bi_bdev->bd_inode),
				iminor(bio->bi_bdev->bd_inode),
				(unsigned long long)bio->bi_iter.bi_sector);
@@ -77,7 +82,8 @@ void end_swap_bio_read(struct bio *bio, int err)
	if (!uptodate) {
		SetPageError(page);
		ClearPageUptodate(page);
		printk(KERN_ALERT "Read-error on swap-device (%u:%u:%Lu)\n",
		if (printk_timed_ratelimit(&error_time, ERROR_LOG_RATE_MS))
			pr_info("Read-error on swap-device (%u:%u:%llu)\n",
				imajor(bio->bi_bdev->bd_inode),
				iminor(bio->bi_bdev->bd_inode),
				(unsigned long long)bio->bi_iter.bi_sector);