diff mbox series

[v5,1/3] mm: don't account memmap on failure

Message ID 20240809191020.1142142-2-pasha.tatashin@soleen.com (mailing list archive)
State New
Headers show
Series Fixes for memmap accounting | expand

Commit Message

Pasha Tatashin Aug. 9, 2024, 7:10 p.m. UTC
When we fail to allocate the mmemmap in alloc_vmemmap_page_list(), do
not account any already-allocated pages: we're going to free all them
before we return from the function.

Fixes: 15995a352474 ("mm: report per-page metadata information")
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Yosry Ahmed <yosryahmed@google.com>
Acked-by: David Hildenbrand <david@redhat.com>
---
 mm/hugetlb_vmemmap.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Muchun Song Aug. 10, 2024, 2:39 a.m. UTC | #1
> On Aug 10, 2024, at 03:10, Pasha Tatashin <pasha.tatashin@soleen.com> wrote:
> 
> When we fail to allocate the mmemmap in alloc_vmemmap_page_list(), do
> not account any already-allocated pages: we're going to free all them
> before we return from the function.
> 
> Fixes: 15995a352474 ("mm: report per-page metadata information")
> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Reviewed-by: Fan Ni <fan.ni@samsung.com>
> Reviewed-by: Yosry Ahmed <yosryahmed@google.com>
> Acked-by: David Hildenbrand <david@redhat.com>

Reviewed-by: Muchun Song <muchun.song@linux.dev>
David Rientjes Aug. 11, 2024, 8:23 p.m. UTC | #2
On Fri, 9 Aug 2024, Pasha Tatashin wrote:

> When we fail to allocate the mmemmap in alloc_vmemmap_page_list(), do
> not account any already-allocated pages: we're going to free all them
> before we return from the function.
> 
> Fixes: 15995a352474 ("mm: report per-page metadata information")
> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Reviewed-by: Fan Ni <fan.ni@samsung.com>
> Reviewed-by: Yosry Ahmed <yosryahmed@google.com>
> Acked-by: David Hildenbrand <david@redhat.com>

Acked-by: David Rientjes <rientjes@google.com>
diff mbox series

Patch

diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
index 829112b0a914..4f51e0596197 100644
--- a/mm/hugetlb_vmemmap.c
+++ b/mm/hugetlb_vmemmap.c
@@ -392,13 +392,10 @@  static int alloc_vmemmap_page_list(unsigned long start, unsigned long end,
 
 	for (i = 0; i < nr_pages; i++) {
 		page = alloc_pages_node(nid, gfp_mask, 0);
-		if (!page) {
-			mod_node_page_state(NODE_DATA(nid), NR_MEMMAP, i);
+		if (!page)
 			goto out;
-		}
 		list_add(&page->lru, list);
 	}
-
 	mod_node_page_state(NODE_DATA(nid), NR_MEMMAP, nr_pages);
 
 	return 0;