From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 833B937F312 for ; Sun, 26 Jul 2026 12:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785068499; cv=none; b=Fn1Xwa6STzQbZ0TRlOCjEWVeW/2zH6Ghae/BIZrpYGshH+Sb6jVwDSa0Op5/b5rHN/bXiAaY/OgZNIj/hGTNWt6fIvDxcf05Ayou7AVZH9klOyQAKzQlOuU78asE5MfcSSiJv0ExVHK/d9HmIm9wJZFdZR41MsHoeuXZbT+SB/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785068499; c=relaxed/simple; bh=DGC8edneAT2NLSx8+7nd6oR/LWcWZjnxLCsZuI7teCE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vDHMrmbCdMgHBAxzKp8Dp38E4jWRDLUYpCgWDDaZjpLJMtkHcfR/iw7mFG8n+ZuhueVIY09yDP2JhUHecyYkGOG3Wi0GgR1vrWsYbFnR/qe4GfPdHbuZHyFKUao6B9hNpRqMhlhAOXrLXPeOfAZQragSxAF5gS9hT8fkc+NyfL4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GCI0st6V; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GCI0st6V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F40C1F000E9; Sun, 26 Jul 2026 12:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785068498; bh=1mYLU4EaS4pxcWMxyoTDGyKkMMBMmDPXY4s8sW+uOWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GCI0st6VMA/PxindSKsTK1fa1HHQNEAhoyMrtjOqHGkV9D8odwoBhfgBsDMnKebTB tzVpHm9cirAefSwjZyxDmzrR/qR74a3sPe/4VI5g1tV5cnthy4Fy0SWSyqJY19MfX6 Bs7uVR5Qpbo+dxZNu/yMUTt4S0Y/1Rj8s3Wz0Y8XswwW4YUU0gyyrPap8yj+/RJ+Nk JTtX7bS0IYLII51VS/I8uEK3s6Cs8PUpj4kq8wUljO5VL8WSXEdWW4HNzbrqPtMlSi 11/GexWl2bplD19vFtxcYfbgcYG0L1SsKAlenfpCawcurtS4IJokDMkU3z19yD3Ewg SpMQ9lG1hDcUw== From: "Barry Song (Xiaomi)" To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: hannes@cmpxchg.org, david@kernel.org, mhocko@kernel.org, qi.zheng@linux.dev, shakeel.butt@linux.dev, ljs@kernel.org, kasong@tencent.com, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, linux-kernel@vger.kernel.org, lyugaofei@xiaomi.com, stevensd@chromium.org, "Barry Song (Xiaomi)" Subject: [RFC PATCH v2 2/5] mm: mglru: only fall back when reclaim is running at high priority Date: Sun, 26 Jul 2026 20:21:20 +0800 Message-Id: <20260726122123.7614-3-baohua@kernel.org> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20260726122123.7614-1-baohua@kernel.org> References: <20260726122123.7614-1-baohua@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Respect the type selected by positive_ctrl_err(), where swappiness controls the relative weights of SP and PV. Falling back too readily undermines that bias. Only fall back after making a sufficient effort to reclaim from the preferred type. Signed-off-by: Barry Song (Xiaomi) --- mm/vmscan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index babbce4bbfe8..4a387cc4145a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4857,10 +4857,14 @@ static int isolate_folios(unsigned long nr_to_scan, struct lruvec *lruvec, * type is still reclaimable; otherwise, it would have * already run out of reclaimable generations. Falling * back too readily can disrupt the positive_ctrl_err() - * bias. + * bias. Also, only fall back when reclaim is running at + * a high priority. */ - if (scanned < nr_to_scan && *isolated < MIN_LRU_BATCH) + if (scanned < nr_to_scan && *isolated < MIN_LRU_BATCH) { + if (sc->priority > 2) + break; type = !type; + } } return total_scanned; -- 2.39.3 (Apple Git-146)