From nobody Wed Feb 11 04:18:15 2026 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (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 1B7E85DF0B for ; Wed, 6 Mar 2024 10:13:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720021; cv=none; b=UkWtT5pxS01sLARJicgRYhwY0r0vBH6V7+cltaFB11AAe1IqX7/z7at4PWofRozlfljbG5iaC/8wHDv4JDuWZH3c4dBy2m/jcguAyxRgWYxLySckkhzvzifGhY2OjgCuerD3AoTiAJo0C2ERdxWyFP9x26I912xPYDEJFmuMSK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720021; c=relaxed/simple; bh=0mmw8V+OMLJ53wZ3rKzZ+MMr209UW8xjMgFiOKuz7rw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=InCA8dGrOC7ct/XzkjBfiBa9dJZAZRZeq4un4v8DBLFE+mah3IiUEd13ZdYStTzU5jPpXIukVbam8BVobS96QjwXjuqd+LxaGYyu+lyeJNS20wws6gVo8PNuWlNlX0Un4vNiVBwy/G3MjXtk0PRzJqwPKv/RFDaT/KKe4/asCvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=ovx+ENA2; arc=none smtp.client-ip=115.124.30.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="ovx+ENA2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1709720016; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=3+gbi0TkcqE1wrd2gyS4ajAOD2lf+Wm0tnSEhRfeeJg=; b=ovx+ENA2ciAIRF89BS1/APfAwi9WM2FNh7KwQ48SMEyvQ+G3ZGSHutWO03xJQk4KMbcrF49etQ0TfnHCNlOnYBUV/3byTPgkKjxqvtWP82HgHzsGnoFBzh/UEjPSCsHtLx8R+04SgeYbv4tRl3ulJ22F505aP3fuXwFhCJFJxGc= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0W1xC4XJ_1709720015; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W1xC4XJ_1709720015) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:13:36 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: muchun.song@linux.dev, osalvador@suse.de, david@redhat.com, linmiaohe@huawei.com, naoya.horiguchi@nec.com, mhocko@kernel.org, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] mm: record the migration reason for struct migration_target_control Date: Wed, 6 Mar 2024 18:13:26 +0800 Message-Id: <7b95d4981e07211f57139fc5b1f7ce91b920cee4.1709719720.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: 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" To support different hugetlb allocation strategies during hugetlb migration based on various migration reasons, record the migration reason in the migration_target_control structure as a preparation. Signed-off-by: Baolin Wang Reviewed-by: Oscar Salvador --- mm/gup.c | 1 + mm/internal.h | 1 + mm/memory-failure.c | 1 + mm/memory_hotplug.c | 1 + mm/mempolicy.c | 1 + mm/migrate.c | 1 + mm/page_alloc.c | 1 + mm/vmscan.c | 3 ++- 8 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index df83182ec72d..959a1a05b059 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2132,6 +2132,7 @@ static int migrate_longterm_unpinnable_pages( struct migration_target_control mtc =3D { .nid =3D NUMA_NO_NODE, .gfp_mask =3D GFP_USER | __GFP_NOWARN, + .reason =3D MR_LONGTERM_PIN, }; =20 if (migrate_pages(movable_page_list, alloc_migration_target, diff --git a/mm/internal.h b/mm/internal.h index 2b7efffbe4d7..47edf69b6ee6 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -959,6 +959,7 @@ struct migration_target_control { int nid; /* preferred node id */ nodemask_t *nmask; gfp_t gfp_mask; + enum migrate_reason reason; }; =20 /* diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 9349948f1abf..780bb2aee0af 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2666,6 +2666,7 @@ static int soft_offline_in_use_page(struct page *page) struct migration_target_control mtc =3D { .nid =3D NUMA_NO_NODE, .gfp_mask =3D GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, + .reason =3D MR_MEMORY_FAILURE, }; =20 if (!huge && folio_test_large(folio)) { diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a444e2d7dd2b..b79ba36e09e0 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1841,6 +1841,7 @@ static void do_migrate_range(unsigned long start_pfn,= unsigned long end_pfn) struct migration_target_control mtc =3D { .nmask =3D &nmask, .gfp_mask =3D GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, + .reason =3D MR_MEMORY_HOTPLUG, }; int ret; =20 diff --git a/mm/mempolicy.c b/mm/mempolicy.c index f60b4c99f130..98ceb12e0e17 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1070,6 +1070,7 @@ static long migrate_to_node(struct mm_struct *mm, int= source, int dest, struct migration_target_control mtc =3D { .nid =3D dest, .gfp_mask =3D GFP_HIGHUSER_MOVABLE | __GFP_THISNODE, + .reason =3D MR_SYSCALL, }; =20 nodes_clear(nmask); diff --git a/mm/migrate.c b/mm/migrate.c index 73a052a382f1..bde63010a3cf 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2060,6 +2060,7 @@ static int do_move_pages_to_node(struct list_head *pa= gelist, int node) struct migration_target_control mtc =3D { .nid =3D node, .gfp_mask =3D GFP_HIGHUSER_MOVABLE | __GFP_THISNODE, + .reason =3D MR_SYSCALL, }; =20 err =3D migrate_pages(pagelist, alloc_migration_target, NULL, diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 96839b210abe..8e6dd3a1028b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6266,6 +6266,7 @@ int __alloc_contig_migrate_range(struct compact_contr= ol *cc, struct migration_target_control mtc =3D { .nid =3D zone_to_nid(cc->zone), .gfp_mask =3D GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, + .reason =3D MR_CONTIG_RANGE, }; =20 lru_cache_disable(); diff --git a/mm/vmscan.c b/mm/vmscan.c index 402c290fbf5a..510f438bb9e0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -978,7 +978,8 @@ static unsigned int demote_folio_list(struct list_head = *demote_folios, .gfp_mask =3D (GFP_HIGHUSER_MOVABLE & ~__GFP_RECLAIM) | __GFP_NOWARN | __GFP_NOMEMALLOC | GFP_NOWAIT, .nid =3D target_nid, - .nmask =3D &allowed_mask + .nmask =3D &allowed_mask, + .reason =3D MR_DEMOTION, }; =20 if (list_empty(demote_folios)) --=20 2.39.3 From nobody Wed Feb 11 04:18:15 2026 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (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 373B55DF2A for ; Wed, 6 Mar 2024 10:13:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720022; cv=none; b=L3GNhTQkp/A3QBslBH4+ZVTvPJKP3yU325pxrqPnfz2PwR2YHskfjHY52B+NDtrN5BtlZZ/1JIwC/BLgdKdi/wwbPRdJyjomR/ZlCJ8uMGqponm8vig9Djp+B/nbTwnMdWuU0mIRhdVoyrvoOhsTs5rbU7VujR7YZ02rurrz0ck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720022; c=relaxed/simple; bh=ps8Ct8bM4ZsoshX0BfG0h/DF5MKG2ATlnihQD4CCqFY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U74o0kzvklN1B3ZSkiYYve5clUgcYV6LGkpih20O1BeLaIDoEOxK908BDViwbSweRtHcrJybio+ErU1q9Wa6pfQcBX7f7/zKrpLobAVDNgmoMWKvCxyd87Zg5AnATlpbplWS2wGgpN3uU0cQ5h8cpPQtgcYYZo7Du0c6kkQA1Iw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=tFVn4nnE; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="tFVn4nnE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1709720017; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=gufctVT71MgKLODZg/m+qbYkjQYb/SdtD29jbaLsG7s=; b=tFVn4nnEcPcUONtzfEm4oQIPNW8CqMzvD6hvd+I9vjjDYaUZ8ALyw8/wVEtk46zvsFHpkSVzy1DBWiy/GAhUf/txfof2Bx6oyLJj7BpyBimtDzV9CgYv06p0GMEn5IEgrQTEVjHv4NiFzRBMzQ+0gG9xKu0ENyMzdqgFBHCHQEE= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0W1xFr15_1709720016; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W1xFr15_1709720016) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:13:37 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: muchun.song@linux.dev, osalvador@suse.de, david@redhat.com, linmiaohe@huawei.com, naoya.horiguchi@nec.com, mhocko@kernel.org, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] mm: hugetlb: make the hugetlb migration strategy consistent Date: Wed, 6 Mar 2024 18:13:27 +0800 Message-Id: <3519fcd41522817307a05b40fb551e2e17e68101.1709719720.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: 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" As discussed in previous thread [1], there is an inconsistency when handing hugetlb migration. When handling the migration of freed hugetlb, it prevents fallback to other NUMA nodes in alloc_and_dissolve_hugetlb_folio(). However, when dealing with in-use hugetlb, it allows fallback to other NUMA nodes in alloc_hugetlb_folio_nodemask(), which can break the per-node hugetlb pool and might result in unexpected failures when node bound workloads doesn't g= et what is asssumed available. To make hugetlb migration strategy more clear, we should list all the scena= rios of hugetlb migration and analyze whether allocation fallback is permitted: 1) Memory offline: will call dissolve_free_huge_pages() to free the freed h= ugetlb, and call do_migrate_range() to migrate the in-use hugetlb. Both can break t= he per-node hugetlb pool, but as this is an explicit offlining operation, no b= etter choice. So should allow the hugetlb allocation fallback. 2) Memory failure: same as memory offline. Should allow fallback to a diffe= rent node might be the only option to handle it, otherwise the impact of poisoned mem= ory can be amplified. 3) Longterm pinning: will call migrate_longterm_unpinnable_pages() to migra= te in-use and not-longterm-pinnable hugetlb, which can break the per-node pool. But w= e should fail to longterm pinning if can not allocate on current node to avoid break= ing the per-node pool. 4) Syscalls (mbind, migrate_pages, move_pages): these are explicit users op= eration to move pages to other nodes, so fallback to other nodes should not be proh= ibited. 5) alloc_contig_range: used by CMA allocation and virtio-mem fake-offline t= o allocate given range of pages. Now the freed hugetlb migration is not allowed to fal= lback, to keep consistency, the in-use hugetlb migration should be also not allowed t= o fallback. 6) alloc_contig_pages: used by kfence, pgtable_debug etc. The strategy shou= ld be consistent with that of alloc_contig_range(). Based on the analysis of the various scenarios above, introducing a new hel= per to determine whether fallback is permitted according to the migration reason.. [1] https://lore.kernel.org/all/6f26ce22d2fcd523418a085f2c588fe0776d46e7.17= 06794035.git.baolin.wang@linux.alibaba.com/ Signed-off-by: Baolin Wang Reviewed-by: Oscar Salvador --- include/linux/hugetlb.h | 35 +++++++++++++++++++++++++++++++++-- mm/hugetlb.c | 14 ++++++++++++-- mm/mempolicy.c | 3 ++- mm/migrate.c | 3 ++- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 77b30a8c6076..e6723aaadc09 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -747,7 +747,8 @@ int isolate_or_dissolve_huge_page(struct page *page, st= ruct list_head *list); struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve); struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred= _nid, - nodemask_t *nmask, gfp_t gfp_mask); + nodemask_t *nmask, gfp_t gfp_mask, + bool allow_alloc_fallback); int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *m= apping, pgoff_t idx); void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, @@ -970,6 +971,30 @@ static inline gfp_t htlb_modify_alloc_mask(struct hsta= te *h, gfp_t gfp_mask) return modified_mask; } =20 +static inline bool htlb_allow_alloc_fallback(int reason) +{ + bool allowed_fallback =3D false; + + /* + * Note: the memory offline, memory failure and migration syscalls will + * be allowed to fallback to other nodes due to lack of a better chioce, + * that might break the per-node hugetlb pool. While other cases will + * set the __GFP_THISNODE to avoid breaking the per-node hugetlb pool. + */ + switch (reason) { + case MR_MEMORY_HOTPLUG: + case MR_MEMORY_FAILURE: + case MR_SYSCALL: + case MR_MEMPOLICY_MBIND: + allowed_fallback =3D true; + break; + default: + break; + } + + return allowed_fallback; +} + static inline spinlock_t *huge_pte_lockptr(struct hstate *h, struct mm_struct *mm, pte_t *pte) { @@ -1065,7 +1090,8 @@ static inline struct folio *alloc_hugetlb_folio(struc= t vm_area_struct *vma, =20 static inline struct folio * alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, - nodemask_t *nmask, gfp_t gfp_mask) + nodemask_t *nmask, gfp_t gfp_mask, + bool allow_alloc_fallback) { return NULL; } @@ -1181,6 +1207,11 @@ static inline gfp_t htlb_modify_alloc_mask(struct hs= tate *h, gfp_t gfp_mask) return 0; } =20 +static inline bool htlb_allow_alloc_fallback(int reason) +{ + return false; +} + static inline spinlock_t *huge_pte_lockptr(struct hstate *h, struct mm_struct *mm, pte_t *pte) { diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 418d66953224..071218141fb2 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2621,7 +2621,7 @@ struct folio *alloc_buddy_hugetlb_folio_with_mpol(str= uct hstate *h, =20 /* folio migration callback function */ struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred= _nid, - nodemask_t *nmask, gfp_t gfp_mask) + nodemask_t *nmask, gfp_t gfp_mask, bool allow_alloc_fallback) { spin_lock_irq(&hugetlb_lock); if (available_huge_pages(h)) { @@ -2636,6 +2636,10 @@ struct folio *alloc_hugetlb_folio_nodemask(struct hs= tate *h, int preferred_nid, } spin_unlock_irq(&hugetlb_lock); =20 + /* We cannot fallback to other nodes, as we could break the per-node pool= . */ + if (!allow_alloc_fallback) + gfp_mask |=3D __GFP_THISNODE; + return alloc_migrate_hugetlb_folio(h, gfp_mask, preferred_nid, nmask); } =20 @@ -6653,7 +6657,13 @@ static struct folio *alloc_hugetlb_folio_vma(struct = hstate *h, =20 gfp_mask =3D htlb_alloc_mask(h); node =3D huge_node(vma, address, gfp_mask, &mpol, &nodemask); - folio =3D alloc_hugetlb_folio_nodemask(h, node, nodemask, gfp_mask); + /* + * This is used to allocate a temporary hugetlb to hold the copied + * content, which will then be copied again to the final hugetlb + * consuming a reservation. Set the alloc_fallback to false to indicate + * that breaking the per-node hugetlb pool is not allowed in this case. + */ + folio =3D alloc_hugetlb_folio_nodemask(h, node, nodemask, gfp_mask, false= ); mpol_cond_put(mpol); =20 return folio; diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 98ceb12e0e17..fe853452db9f 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1228,7 +1228,8 @@ static struct folio *alloc_migration_target_by_mpol(s= truct folio *src, h =3D folio_hstate(src); gfp =3D htlb_alloc_mask(h); nodemask =3D policy_nodemask(gfp, pol, ilx, &nid); - return alloc_hugetlb_folio_nodemask(h, nid, nodemask, gfp); + return alloc_hugetlb_folio_nodemask(h, nid, nodemask, gfp, + htlb_allow_alloc_fallback(MR_MEMPOLICY_MBIND)); } =20 if (folio_test_large(src)) diff --git a/mm/migrate.c b/mm/migrate.c index bde63010a3cf..ab9856f5931b 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2022,7 +2022,8 @@ struct folio *alloc_migration_target(struct folio *sr= c, unsigned long private) =20 gfp_mask =3D htlb_modify_alloc_mask(h, gfp_mask); return alloc_hugetlb_folio_nodemask(h, nid, - mtc->nmask, gfp_mask); + mtc->nmask, gfp_mask, + htlb_allow_alloc_fallback(mtc->reason)); } =20 if (folio_test_large(src)) { --=20 2.39.3 From nobody Wed Feb 11 04:18:15 2026 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) (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 041235D750 for ; Wed, 6 Mar 2024 10:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720023; cv=none; b=MusrVvZHrbsTnpUyZOXZwmnSBXRRF9Zbs7ObEcklZlHCHZvlMlgy8KTG0+KbQsH8yX95NfCTzQrvuaR4l2Hc6SeRJy0jOjs8FEAaMxiJEg2q+czdHm/nzLQnNzhuN1sFa7Sb+PLwrkwvrHrV4Yx4IyqVpw1SUIbvm8Wr8bRWyIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720023; c=relaxed/simple; bh=MzCC0AE/rUvpEAo4tb5cVZ7cGsewHKgZszzxyYlWgms=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=foAprtJ0H+fGcIz4XPbPNRAhY935n/+B6B8RZibPe80XKR0g/n0TKrliKrklrxgYo03xj/EGaw6ob3JSkkmDAEWpmI/+qo07/D10xj++eNB4S7TIkVZI8tDMjNmfSwlWp2xIDi/68x8qdKaHFyuyG+tz/pg6QItpn7+L7BrbJEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=aVH/oJsK; arc=none smtp.client-ip=115.124.30.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="aVH/oJsK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1709720018; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=jQS6ixAjVk0AC8cKYwTBDAm2HkLKEDsUdifzfOmBcs0=; b=aVH/oJsKmuK6AiXGW+Yhae9St6wsrA+7CYmVTQyL6WXrMA45Ym8q7cE4mc3QAGNjSve/8uzcXVWPvHkxX9Lo1UKlrEko+TNsrrsRzfrKXLFO6PYLgwM5NjXyyZfAuimM0UZnYzeqp8abGal/E6v5Vx+OfdCGAPr9JhSCGrzwp24= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0W1xC4Y-_1709720017; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W1xC4Y-_1709720017) by smtp.aliyun-inc.com; Wed, 06 Mar 2024 18:13:38 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: muchun.song@linux.dev, osalvador@suse.de, david@redhat.com, linmiaohe@huawei.com, naoya.horiguchi@nec.com, mhocko@kernel.org, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] docs: hugetlbpage.rst: add hugetlb migration description Date: Wed, 6 Mar 2024 18:13:28 +0800 Message-Id: <63fb16e7a4ebc5cb69ce655af86e29b2d8e9ba34.1709719720.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: 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" Add some description of the hugetlb migration strategy. Signed-off-by: Baolin Wang --- Documentation/admin-guide/mm/hugetlbpage.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/admin-guide/mm/hugetlbpage.rst b/Documentation/a= dmin-guide/mm/hugetlbpage.rst index e4d4b4a8dc97..f34a0d798d5b 100644 --- a/Documentation/admin-guide/mm/hugetlbpage.rst +++ b/Documentation/admin-guide/mm/hugetlbpage.rst @@ -376,6 +376,13 @@ Note that the number of overcommit and reserve pages r= emain global quantities, as we don't know until fault time, when the faulting task's mempolicy is applied, from which node the huge page allocation will be attempted. =20 +The hugetlb may be migrated between the per-node hugepages pool in the fol= lowing +scenarios: memory offline, memory failure, longterm pinning, syscalls(mbin= d, +migrate_pages and move_pages), alloc_contig_range() and alloc_contig_pages= (). +Now only memory offline, memory failure and syscalls allow fallbacking to = allocate +a new hugetlb on a different node if the current node is unable to allocat= e during +hugetlb migration, that means these 3 cases can break the per-node hugepag= es pool. + .. _using_huge_pages: =20 Using Huge Pages --=20 2.39.3