From nobody Thu Oct 9 20:21:56 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8776C288C2B; Mon, 16 Jun 2025 17:23:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750094631; cv=none; b=POCo4ToRbZ2+AAlFY9pmuhdRsC8Oj9X5tt0XB+KXStpNWfZfNf9jlxZDowT4ScNSBwtnIPoreIMYvUJPSqWp7saUuQ//GyXBP2M9+EjTMnvrw8lhoFLnYhm3Y98KvuUR3K1fDOfVOqu4LI06nBQThp47HoNwebORUTMc2p3uYOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750094631; c=relaxed/simple; bh=jnTsM17LtmINmtfyvAGM5i8zoPOwCcuXIDUVAUmB5ZQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jIkXJHPCcCsZO66AAvpS/dlV4pi492Ht67BQ0Ia5uiEFG+puFU1d1i1LfSgwUA01rmTsI7gYRfGJ73Lm1KFZtq0Bi/o4J8fXTvpNOT4IYMCYnK5Q43Zku4/WBldnrpx5dze6+4shUBfyyssD8CLGwia63lfZvp47MIkZmEToOYM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aP2bHBVK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aP2bHBVK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01C51C4CEEA; Mon, 16 Jun 2025 17:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750094631; bh=jnTsM17LtmINmtfyvAGM5i8zoPOwCcuXIDUVAUmB5ZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aP2bHBVKWXUKPdwARM5mBbkAco1AoG3cGAYwpasfwtSu0kpmv0qKtPKiqg9p+cg+m B5RKz0DUji59WKUpNBmnUfppHapP3m1EPG/9KN+kLA+L9yTSISErT1p/iRxiFhTbBe oVMSbjmGCd0ihlmnTVdfVUpne+EbVkA5iTzONJMW1FRiIheo2BHA9zZYNbrConG/SD ydLsrfUTGiObElvrkPS/RtCUaqcTO8QirdT1EDEZmBoRbkZC3wRJ9r3qP1yDa/1Xlq rCv4lMzR+2OZqciKheK4XI9rgBEasqySGIqW1Tcwx9n0Hs5+41B9O1xPa+1ILG422T EI20cr9O/A+YQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Honggyu Kim , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask Date: Mon, 16 Jun 2025 10:23:44 -0700 Message-Id: <20250616172346.67659-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250616172346.67659-1-sj@kernel.org> References: <20250616172346.67659-1-sj@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: quoted-printable Content-Type: text/plain; charset="utf-8" DAMOS_MIGRATE_{HOT,COLD} implementation resembles that for demote_folio_list(). Because those are not only for demotion but general folio migrations, it makes more sense to behave similarly to move_pages() system call. Make the behavior more similar to move_pages(), by using alloc_migration_target() instead of alloc_migrate_folio(), without fallback nodemask. Signed-off-by: SeongJae Park Reviewed-by: Joshua Hahn --- mm/damon/paddr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 4102a8c5f992..fcab148e6865 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -386,7 +386,6 @@ static unsigned int __damon_pa_migrate_folio_list( int target_nid) { unsigned int nr_succeeded =3D 0; - nodemask_t allowed_mask =3D NODE_MASK_NONE; struct migration_target_control mtc =3D { /* * Allocate from 'node', or fail quickly and quietly. @@ -396,7 +395,6 @@ static unsigned int __damon_pa_migrate_folio_list( .gfp_mask =3D (GFP_HIGHUSER_MOVABLE & ~__GFP_RECLAIM) | __GFP_NOWARN | __GFP_NOMEMALLOC | GFP_NOWAIT, .nid =3D target_nid, - .nmask =3D &allowed_mask }; =20 if (pgdat->node_id =3D=3D target_nid || target_nid =3D=3D NUMA_NO_NODE) @@ -406,7 +404,7 @@ static unsigned int __damon_pa_migrate_folio_list( return 0; =20 /* Migration ignores all cpuset and mempolicy settings */ - migrate_pages(migrate_folios, alloc_migrate_folio, NULL, + migrate_pages(migrate_folios, alloc_migration_target, NULL, (unsigned long)&mtc, MIGRATE_ASYNC, MR_DAMON, &nr_succeeded); =20 --=20 2.39.5 From nobody Thu Oct 9 20:21:56 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 64F61288C95; Mon, 16 Jun 2025 17:23:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750094632; cv=none; b=SwQdlwWlcRvFLXEZ/XUpQlyt+bhkTWtDRrUQTkiNeKn4w37nmEIf2GNESen70MMuSkjjiMBGbeBaeUZvUEYC4hUalpkzvZzp5XzhjAuW77zIb81S9Nsn3M7TdZuM5KSHxWFJ6bUU8B3MV5IqLzc+vRslm6F30rLjfl13hFJNbBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750094632; c=relaxed/simple; bh=NOlqXu1Kg0/ms957gwPWMk5PWBJC6WX6Zl6AgwkZrrI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VXCJxcg3Jq0VcUmwdsjFHmM7SMgBNV0sxGnUdYZ66wn8T1RrraIp58xnaStxwKsHIAipcsdGoYxJD6K5NvHABNAwvv917hvG5Z9NiKMBtF093G2ALfmt7oPRgW07ZmmQI9SI3jGeeCF0nIeoWMLTOGfeDsELgJxGQ/MJz5CsHSA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CiAc9olN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CiAc9olN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12136C4CEEA; Mon, 16 Jun 2025 17:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750094632; bh=NOlqXu1Kg0/ms957gwPWMk5PWBJC6WX6Zl6AgwkZrrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CiAc9olN0+Oin6KtnUIi1SwOuIovCaArn6UMRu5OS0/4j0XG54149WQurEDbvvjYs EbWrRBFmipFUA/A14rWbP/Y3dmxaWtL9bFh9trsHZoo37/Cu5p23YIq08XOzp5ZWJB dOF2fH+FpnNuSqfaVCwtNkf1eyrJDrx5b3vydYHpDV4tJ6ruzWxaHxxgYEh6HAo2qw 94S3nwkanTR2CjWc6vEc0L5omc/3u1M2tQtlWW6FTSgdP6ObqAjARBltCWaF19/q2u Rkry65PU+o8RVvL/FVove1VKCRnLsHmokXs9arfvUKV7XaurxVSb9fhznJQekV0nbZ rRLIcihU5jWRg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , David Hildenbrand , Honggyu Kim , Johannes Weiner , Lorenzo Stoakes , Michal Hocko , Qi Zheng , Shakeel Butt , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/3] Revert "mm: rename alloc_demote_folio to alloc_migrate_folio" Date: Mon, 16 Jun 2025 10:23:45 -0700 Message-Id: <20250616172346.67659-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250616172346.67659-1-sj@kernel.org> References: <20250616172346.67659-1-sj@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: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 8f75267d22bdf8e3baf70f2fa7092d8c2f58da71. Commit 8f75267d22bd ("mm: rename alloc_demote_folio to alloc_migrate_folio") was to reflect the fact the function is called for not only demotion, but also general migrations from DAMOS_MIGRATE_{HOT,COLD}. The previous commit made the DAMOS actions to not use alloc_migrate_folio(), though. So, demote_folio_list() is the only caller of alloc_migrate_folio(), and the name could now be rather confusing. Revert the renaming commit. Signed-off-by: SeongJae Park Reviewed-by: Joshua Hahn --- mm/internal.h | 2 +- mm/vmscan.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 3823fb356d3b..aedcf95737ed 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1227,7 +1227,7 @@ extern unsigned long __must_check vm_mmap_pgoff(stru= ct file *, unsigned long, unsigned long, unsigned long); =20 extern void set_pageblock_order(void); -struct folio *alloc_migrate_folio(struct folio *src, unsigned long private= ); +struct folio *alloc_demote_folio(struct folio *src, unsigned long private); unsigned long reclaim_pages(struct list_head *folio_list); unsigned int reclaim_clean_pages_from_list(struct zone *zone, struct list_head *folio_list); diff --git a/mm/vmscan.c b/mm/vmscan.c index a93a1ba9009e..6bebc91cbf2f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1006,7 +1006,7 @@ static void folio_check_dirty_writeback(struct folio = *folio, mapping->a_ops->is_dirty_writeback(folio, dirty, writeback); } =20 -struct folio *alloc_migrate_folio(struct folio *src, unsigned long private) +struct folio *alloc_demote_folio(struct folio *src, unsigned long private) { struct folio *dst; nodemask_t *allowed_mask; @@ -1069,7 +1069,7 @@ static unsigned int demote_folio_list(struct list_hea= d *demote_folios, node_get_allowed_targets(pgdat, &allowed_mask); =20 /* Demotion ignores all cpuset and mempolicy settings */ - migrate_pages(demote_folios, alloc_migrate_folio, NULL, + migrate_pages(demote_folios, alloc_demote_folio, NULL, (unsigned long)&mtc, MIGRATE_ASYNC, MR_DEMOTION, &nr_succeeded); =20 --=20 2.39.5 From nobody Thu Oct 9 20:21:56 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BC54928936B; Mon, 16 Jun 2025 17:23:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750094634; cv=none; b=ozV/cGJ5nfI2LjPTKRiw8tx/7XoeUwuFw5nkUimW3+c7PDSNVpO/5IqOBRSBubXxLdFDdFq2vgMuK6YwAkMI3L9/J47mg2UHX34RoqPi31IQ59kI8+FgxnWiDBGlOXDD4LxfklF7ulUHb9IdsjpbVSn2g8q5oMB1DpC9XlLlsdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750094634; c=relaxed/simple; bh=/jZrQ9S1/qKDrhEa24isAWnQHzj9GQjAjLTNE9pKE2E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BFvmisgn7s9TNpCm7X8l5Ecxv+PCw0MjgG83wlreB38vl0PNy60YL6SkR0ullYIIvRy6EiwMgV0IQeHmgYkxCpV37fVn0UUFlmKmblkWP3tvtLq61reWwBeWM5gme8rv2UHH25zTvSwZS/f0tqQ0wXQDFFTRphy6jvZh3eKKIbY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jWTjQjS9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jWTjQjS9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FBC8C4CEF4; Mon, 16 Jun 2025 17:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750094633; bh=/jZrQ9S1/qKDrhEa24isAWnQHzj9GQjAjLTNE9pKE2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWTjQjS9OREK8EWUzjoQa7VWHP+QHa8ZXxQ/EMPS1ieWcV0CxI0SlDnsuojqQqgGN zY6dSApgSD08wg5HPYrDIV4TNwSyI929S7qSj+filcsX+r8s5PlKtErBM4nRmSH2gL ZQwzCiDwzLJSdAErNStpbvvejPBySymv9zO72+e/vUcCzgyFrEqgZJlRZGjeBH69dU /gZFvr8xNPwzO6+Yxup0D3x41hFxITQer7aT0rPZ7bIuruVJJSklKoi9WV71Z3wBq6 +fBbE7g5EHtTjh4scICSo0jew4Of8R7ItRWW6o2GJPiwlkL1/6jF7wnbp21HKESpCl XRmNxXpYC16DA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , David Hildenbrand , Honggyu Kim , Johannes Weiner , Lorenzo Stoakes , Michal Hocko , Qi Zheng , Shakeel Butt , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/3] Revert "mm: make alloc_demote_folio externally invokable for migration" Date: Mon, 16 Jun 2025 10:23:46 -0700 Message-Id: <20250616172346.67659-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250616172346.67659-1-sj@kernel.org> References: <20250616172346.67659-1-sj@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: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit a00ce85af2a1be494d3b0c9457e8e81cdcce2a89. Commit a00ce85af2a1 ("mm: make alloc_demote_folio externally invokable for migration") was made to let DAMOS_MIGRATE_{HOT,COLD} call the function. But a previous commit made DAMOS_MIGRATE_{HOT,COLD} call alloc_migration_target() instead. Hence there are no more callers of the function outside of vmscan.c. Revert the commit to make the function static again. Signed-off-by: SeongJae Park Reviewed-by: Joshua Hahn --- mm/internal.h | 1 - mm/vmscan.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index aedcf95737ed..746fa4187e9e 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1227,7 +1227,6 @@ extern unsigned long __must_check vm_mmap_pgoff(stru= ct file *, unsigned long, unsigned long, unsigned long); =20 extern void set_pageblock_order(void); -struct folio *alloc_demote_folio(struct folio *src, unsigned long private); unsigned long reclaim_pages(struct list_head *folio_list); unsigned int reclaim_clean_pages_from_list(struct zone *zone, struct list_head *folio_list); diff --git a/mm/vmscan.c b/mm/vmscan.c index 6bebc91cbf2f..620dce753b64 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1006,7 +1006,8 @@ static void folio_check_dirty_writeback(struct folio = *folio, mapping->a_ops->is_dirty_writeback(folio, dirty, writeback); } =20 -struct folio *alloc_demote_folio(struct folio *src, unsigned long private) +static struct folio *alloc_demote_folio(struct folio *src, + unsigned long private) { struct folio *dst; nodemask_t *allowed_mask; --=20 2.39.5