From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05350362137 for ; Mon, 23 Feb 2026 12:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.67 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771850364; cv=none; b=pkVMwPIoahPoFHbsIfjIOEitqyj5GtxzONAKygBuRBDTG2vHplevmkmrXA6zrv50of6GxVbyByE7/xnulk1qy7VZYC8OED+zxzp6jBB49/lty2rAwMnfc/7IQ4ZYnjJ7JCs9iU2gqabeW57UbySmEGkzfdPHWcEDnk1yFQ5uUis= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771850364; c=relaxed/simple; bh=tIR9ZTfFc43iogKN4VnltVCT61CN1KDGtyex8888EAI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qpT3GhGG2SLa5gs/em8sLGjF0gKsWLfpf6QUTM8YwMF1UlRRsVYv0vqWB+9zJOT1xWQjKSvDfwK6s22yv+pwCivrB0NfuQdX7HHo5U35o6zAHeQYZjW0Qe7e93uTNM3umc1jLuaOBc0BizayJOPLyPKq8acK32Q25InlwDiON+w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GygvMZMF; arc=none smtp.client-ip=209.85.219.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GygvMZMF" Received: by mail-qv1-f67.google.com with SMTP id 6a1803df08f44-897023602b1so48988646d6.0 for ; Mon, 23 Feb 2026 04:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771850362; x=1772455162; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m9zxhRiY07QYTGDQv6Cv2204Go1scw2vYwkAtxLUmkI=; b=GygvMZMF44cFtQ93sB1QDDkN3jVICeqdLkEy2zA8DOFN0ipbX6OyHfmU3ylyRvw/3K /OX8xzebg+tpBdVgxPplJOUzJF0VvGZdqwGHrqOooLl5/oDYJyT+GVyVWKLKLfoCHdnw 53v7IT6wl/Y1D+zMMC//4zOMmGJsxUAmQ9T1LI8sSQNYTMYjTnHLMXszMcwlmbwyxUuv is6EMp3HpaFRfpYpdQbWXIGeITzCbXXnX33IcAZRxZ5tC3VYzj3xphaBbf2J6AuU5IO4 U+8jGQxvgLBfVl4OWt/7xyDI5wRqFRTTWYY94dfAkCifQUHzRJb/hC7plxzlA0Ya3X3y eXCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771850362; x=1772455162; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=m9zxhRiY07QYTGDQv6Cv2204Go1scw2vYwkAtxLUmkI=; b=aSm1zpH5G3gazqWwAwT7tWS5hr4dm6uTEuKZPryG/jKl3ifqcc/G1IULwGpI2troNg yiCdeI+Xqa605ZVADOtRb/w/ZHJKtoQF9PvYgjXuJzEqJehEOwoQuSCNeA9d+y3gc67m 4TtL/Vxq6jWBBQWqD7gB7ryjTyJ29xUC0VV5GVxrTEuCO/bq51/y6/dfxNNtuaTOLuRI ROvcU+IPn1TJ2T+glsWHBCzaMytnm4tYAiJgwFMtsHfK3rqII4kwoAwMOpqIIuYW9/Bq O9Dw1yNRVYOxaaK8FBk85CFM/BoMqzRpHd+1SZZZw+XvOZ4YkGdxGzKTkIhrd37ggN8+ AsjQ== X-Forwarded-Encrypted: i=1; AJvYcCWsuRLbqGdpav9+u29oDaJAYiaOcCdeDdcycg5x02KbNf98glcmz+l4RTOqzEHkOO9oC1khViEM6hLhssE=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0cZTNoF4X40qYGSYkciNQqLnHcwL3Zbb6VGc8yU4Agy2VCXNB 6XE71kNO7/s/u4tdrOWb/Ti0wzeHUkgJB8GhQZEGLjBMRr3KFlRu34dvTosGB4NO5w== X-Gm-Gg: ATEYQzzPeLNOWsgyhP/nWqeEMugbYjCu9SdwSxA75Q6IxK5RcuG+vTw/LFB/3QbxneF KWcCQ+STPO3OkIRsvv+OT2XKHeRGF8Fq4F82QS9wGPYRu17KAhuX10X+wYBSTT/s75ma1+Tw7Mn CrTYCgP7vQjpi4/q4pwiYbCWcv20jqpOtNUH+x4dHvBTODGXKpdHk09M/f/vJXWSr2VAA/JDCdP k8vGBLfZLvk5SELRKVNBPtmQsfpRUYOuZ523uvdRqrtySF2E6b7F2kvHchZ2Ipu/3LfVCsjU5KR suMC4EPKhiYN4++qVwx1cRaCd/NG995sWiKgH0jR7VG20ZrenMK8ukNbk+X680bhKx31GoH/6IP uz/hPqlY5LVKGKC7jp6nfihW3lfKgeTYf879m8sQRqgCgd7pilaBj4R5KrxG4Ocu2Ok/uVISbY5 Lj1NAmz3+hvpdrqAkC2sKVYLCKyGAwvrqtMrbD+yMzrbFU X-Received: by 2002:a05:6a20:439e:b0:394:6023:a0fd with SMTP id adf61e73a8af0-39545ed05cfmr7352911637.29.1771849978382; Mon, 23 Feb 2026 04:32:58 -0800 (PST) Received: from LAPTOP-FDBL0TVI.localdomain ([49.37.157.71]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c70b71a73e1sm7454739a12.13.2026.02.23.04.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Feb 2026 04:32:57 -0800 (PST) From: Ravi Jonnalagadda To: sj@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: akpm@linux-foundation.org, corbet@lwn.net, bijan311@gmail.com, ajayjoshi@micron.com, honggyu.kim@sk.com, yunjeong.mun@sk.com, Ravi Jonnalagadda Subject: [RFC PATCH v3 2/4] mm/damon: fix esz=0 quota bypass allowing unlimited migration Date: Mon, 23 Feb 2026 12:32:30 +0000 Message-ID: <20260223123232.12851-3-ravis.opensrc@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260223123232.12851-1-ravis.opensrc@gmail.com> References: <20260223123232.12851-1-ravis.opensrc@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When the TEMPORAL goal tuner sets esz_bp=0 to signal that a goal has been achieved, the quota check was not actually stopping migration. The condition: if (quota->esz && quota->charged_sz >= quota->esz) When esz=0, this evaluates to (false && ...) = false, so the continue is never executed and migration proceeds without limit. Change the logic to: if (!quota->esz || quota->charged_sz >= quota->esz) Now when esz=0, (!0 = true) causes the continue to execute, properly stopping migration when the goal is achieved. This is critical for the TEMPORAL tuner to work correctly - without this fix, setting esz=0 has no effect and migration continues until all hot memory is moved, overshooting the target goal. Signed-off-by: Ravi Jonnalagadda --- mm/damon/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index 614f1f08eee9..b438355ab54a 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2394,8 +2394,8 @@ static void damon_do_apply_schemes(struct damon_ctx *c, if (!s->wmarks.activated) continue; - /* Check the quota */ - if (quota->esz && quota->charged_sz >= quota->esz) + /* Check the quota: skip if esz=0 (goal achieved) or exhausted */ + if (!quota->esz || quota->charged_sz >= quota->esz) continue; if (damos_skip_charged_region(t, r, s, c->min_region_sz)) -- 2.43.0