Skip to content

Commit 2985dae

Browse files
Alexei Starovoitovtorvalds
authored andcommitted
mm/page_alloc: Fix try_alloc_pages
Fix an obvious bug. try_alloc_pages() should set_page_refcounted. [ Not so obvious: it was probably correct at the time it was written but was at some point then rebased on top of v6.14-rc1. And at that point there was a semantic conflict with commit efabfe1 ("mm/page_alloc: move set_page_refcounted() to callers of get_page_from_freelist()") and became buggy. - Linus ] Fixes: 97769a5 ("mm, bpf: Introduce try_alloc_pages() for opportunistic page allocation") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil BAbka <vbabka@suse.cz> Reviewed-by: Harry Yoo <harry.yoo@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5de0afb commit 2985dae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mm/page_alloc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7385,6 +7385,9 @@ struct page *try_alloc_pages_noprof(int nid, unsigned int order)
73857385

73867386
/* Unlike regular alloc_pages() there is no __alloc_pages_slowpath(). */
73877387

7388+
if (page)
7389+
set_page_refcounted(page);
7390+
73887391
if (memcg_kmem_online() && page &&
73897392
unlikely(__memcg_kmem_charge_page(page, alloc_gfp, order) != 0)) {
73907393
free_pages_nolock(page, order);

0 commit comments

Comments
 (0)