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

Commit ee081c23 authored by Vinayak Menon's avatar Vinayak Menon
Browse files

mm: swap: fix swapcache usage for fast swap devices



1) The swap readahead algorithm need not be applied for fast swap
devices like zram.
2) Code to set SWP_FAST is placed incorrectly, resulting in the flag
not being set.
Fix these to reduce the swapcache usage.

Change-Id: I23d9af5819f4b25f90f14a12657fa19ed401fb2a
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
parent 03e6490b
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -475,11 +475,10 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask,
	unsigned long entry_offset = swp_offset(entry);
	unsigned long offset = entry_offset;
	unsigned long start_offset, end_offset;
	unsigned long mask = is_swap_fast(entry) ? 0 :
				(1UL << page_cluster) - 1;
	unsigned long mask;
	struct blk_plug plug;

	mask = swapin_nr_pages(offset) - 1;
	mask = is_swap_fast(entry) ? 0 : swapin_nr_pages(offset) - 1;
	if (!mask)
		goto skip;

+3 −3
Original line number Diff line number Diff line
@@ -2559,10 +2559,10 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
				pr_err("swapon: discard_swap(%p): %d\n",
					p, err);
		}
	}

		if (blk_queue_fast(bdev_get_queue(p->bdev)))
	if (p->bdev && blk_queue_fast(bdev_get_queue(p->bdev)))
		p->flags |= SWP_FAST;
	}

	mutex_lock(&swapon_mutex);
	prio = -1;