[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86BDA7AC-3E7A-4779-9388-9DF7BA7230AA@vmware.com>
Date: Mon, 8 Nov 2021 06:12:11 +0000
From: Alexey Makhalov <amakhalov@...are.com>
To: David Hildenbrand <david@...hat.com>
CC: Michal Hocko <mhocko@...e.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
Oscar Salvador <OSalvador@...e.com>
Subject: Re: [PATCH] mm: fix panic in __alloc_pages
I’m going to send patch v2, with node_online check moved to caller (pcpu_alloc_pages() function)
as was suggested by David. It seems as it is only one place which passes present but offlined
node to alloc-pages_node(). Moving node online check to the caller keeps hot path (alloc_pages)
simple and performant.
> diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c
> index 2054c9213c43..c21ff5bb91dc 100644
> --- a/mm/percpu-vm.c
> +++ b/mm/percpu-vm.c
> @@ -84,15 +84,19 @@ static int pcpu_alloc_pages(struct pcpu_chunk *chunk,
> gfp_t gfp)
> {
> unsigned int cpu, tcpu;
> - int i;
> + int i, nid;
>
> gfp |= __GFP_HIGHMEM;
>
> for_each_possible_cpu(cpu) {
> + nid = cpu_to_node(cpu);
> +
> + if (nid == NUMA_NO_NODE || !node_online(nid))
> + nid = numa_mem_id();
> for (i = page_start; i < page_end; i++) {
> struct page **pagep = &pages[pcpu_page_idx(cpu, i)];
>
> - *pagep = alloc_pages_node(cpu_to_node(cpu), gfp, 0);
> + *pagep = alloc_pages_node(nid, gfp, 0);
> if (!*pagep)
> goto err;
> }
>
Thanks,
—Alexey
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists