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

Commit 45b8dd2a authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mm: swap_ratio: bail out if there aren't any other swap device"

parents 62627c00 62557761
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -78,6 +78,12 @@ static int swap_ratio_slow(struct swap_info_struct **si, int node)
	n = plist_next_entry(&(*si)->avail_lists[node],
			struct swap_info_struct,
			avail_lists[node]);
	if (n == *si) {
		/* No other swap device */
		ret = -ENODEV;
		goto skip;
	}

	spin_unlock(&swap_avail_lock);
	spin_lock(&n->lock);
	spin_lock(&swap_avail_lock);
@@ -175,6 +181,9 @@ void setup_swap_ratio(struct swap_info_struct *p, int prio)

int swap_ratio(struct swap_info_struct **si, int node)
{
	if (!sysctl_swap_ratio_enable)
		return -ENODEV;

	if (is_swap_ratio_group((*si)->prio))
		return swap_ratio_slow(si, node);
	else