From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796488927; b=YfmHV/euVZmw15SOfBIgECeiNRVoQEdPZomjeuhqHsxm1whPDoAcDnKLg6+G2GhWAX4N oyi3yvAisr3SCGAQSpqQwGva0ije46/kSA3Pfr5CQENLLn0r7j6hSFUdY+0iFCYLnH8FJ CzjtVl9awlOE1savoJ2NMc5VaOYjrRWnmtNQduAQVEnVcSAwSy1z0RjvqlmV7zq/Grcej /xHARcZsj4WQLaB725mrtmJyhBYHTvYvKko+6Bg7siuC8WFl2JwDaFfJH0apdI2R9u3iA RNf7ELptQpbVf2H0MZ5P3UzdnovDV8s5crbud/4T63Qc7O0e5GTU341PeftPaIsld3Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796488927; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=Fkpo3CQB2LtdGcWjUfmPi/uMYgFcJkkjbEYeEl1LSc4=; b=WT/5eom94u7nfmkgGJlxSejsTsf2R8AMSPsBRTBCampwKLkSVhGFrIwc66vAZEqwimRa AIA1P0uARUNBk4Im/ACj4FlJTgQ/FuZGcGjhfpFqjh4y9mGeLk8asLPhFLxlClDovnPx1 RS+DQcCwQ1cyRzK011i260+cvTKZQ+GAANoQMYqNNhEit8nZ0F+tuGBTflB6Q9ViMMsHZ ShuZQOP5dTIbYqHci1aaawMDdgGcWcx1r7Eh5r0K72B19ltDcuvVjRfYvH/w3ySwAbGxH naY9yJSH909O1+rUtxtfw9h45BYSBlDcynbMXjSfgofTyJdebGbTrx1c2+6exzeah9A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=brtlaCBF; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A625D606A31F; Sat, 5 Dec 2026 16:42:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=brtlaCBF Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4AB21F0092B; Sat, 5 Dec 2026 16:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796488927; bh=Fkpo3CQB2LtdGcWjUfmPi/uMYgFcJkkjbEYeEl1LSc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=brtlaCBFNZARzUM1twdKV1svLfwkPq0ky22c8guzCiY4NZMLf9T8lLp66h8gccERP FxQzAmG6/13+vrF3ZvLM87G2XrLEZpBsKHAGR+UDBbJ94bMl7gcXU/YOJMUPYvlVub Sy48sa/FDYSYxsZQYRsra/DMSpd8brunlMTFzzltGziBYow4KiumR7vUCWmaNDqh0l KYHqrTMl1XQCdB4jeOSfT01dHSvEVVXrsJ/6qGjrVRVYcIZwUgGPsn4bvBMwu08Hbp qpyc8GjMXTqHeIEz1pXrybfqqA04A0VHqlJEIpbhyHWXoUFIqIraCJkcEamSxehgxn aKnuEtth+HpXg== From: SJ Park To: Kyuwon Cho Cc: SJ Park , Andrew Morton , Quanmin Yan , Aveline Noir , sashiko-bot@kernel.org, sashiko-reviews@lists.linux.dev, damon@lists.linux.dev, linux-mm@kvack.org Subject: Re: [PATCH v3 0/4] mm/damon/paddr: prevent address wrap in action walks Date: Sat, 5 Dec 2026 08:41:58 -0800 Message-ID: <20261205164159.91929-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: X-Mailing-List: damon@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Sat, 5 Dec 2026 10:52:00 +0900 Kyuwon Cho wrote: > The four physical-address DAMOS action walks advance a page-aligned cursor > by PAGE_SIZE or folio_size(). If the physical end of a region is near > PHYS_ADDR_MAX, either addition can wrap the cursor to zero. > > Depending on where the wrap makes the loop restart, and on the folio > states and sizes in the address range, the walk can repeat multiple times. > In the worst case, it can be infinite. > > As a result, kdamond can affect unexpectedly much memory and consume > system resources. Users cannot stop it because the busy kdamond does not > respond to DAMON sysfs input. Regions ending near PHYS_ADDR_MAX are rare > in practice, but the consequence is severe. > > Calculate each converted end once before its loop and saturate every > PAGE_SIZE or folio-size advance at that end. Keep the fixes split by the > commits that introduced the walks so they can be backported independently. > > --- > Changes in v3: > - Restore the impact description, including the indefinite repeat, using > wording suggested by SJ Park. > - Hoist each end calculation before its loop and fold the separately > posted endpoint optimization into the fixes, as suggested by SJ Park. > - Correct the Fixes tags after SJ Park noted that the pageout tag was too > new. Aveline Noir identified the commit that introduced the pageout > walk. Thank you for doing the revisioning. > > The separate endpoint optimization can be dropped: > https://lore.kernel.org/all/179636379461.1106205.7227742056101745798@skku.edu/ > > The v3 plan discussion: > https://lore.kernel.org/all/179640027323.1616253.15840107925779563493@skku.edu/ > > v2: > https://lore.kernel.org/all/179636379461.1106205.17118044826561378975@skku.edu/ > > v1: > https://lore.kernel.org/all/179614474316.1073623.13833808548597202010@skku.edu/ >From the next time, please add changelog for all previous versions, like the doc [1] suggests. > > The issue was found by an LLM-guided test generator that we are > developing as a research prototype. Forgot saying this to the first version. Knowing this kind of context is very helpful for reviewing. Thank you. > > The sysfs test case was posted in the v2 discussion: > https://lore.kernel.org/all/179640027309.1616249.12163670586345074790@skku.edu/ Appreicate sharing of the reproducer, too. All looks good to me. For the series, Reviewed-by: SJ Park This patch is applied to damon/next [1] tree. I will repost it soon (~1 week) as an mm.git merge request. So, no action from your side is needed for now. [1] https://docs.kernel.org/process/submitting-patches.html#commentary [2] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees Thanks, SJ [...]