[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240725061513.kiqu2k5z7rrl6a3f@oppo.com>
Date: Thu, 25 Jul 2024 14:15:13 +0800
From: Hailong.Liu <hailong.liu@...o.com>
To: Matthew Wilcox <willy@...radead.org>
CC: Andrew Morton <akpm@...ux-foundation.org>, Uladzislau Rezki
<urezki@...il.com>, Christoph Hellwig <hch@...radead.org>, Lorenzo Stoakes
<lstoakes@...il.com>, Vlastimil Babka <vbabka@...e.cz>, Michal Hocko
<mhocko@...e.com>, Barry Song <21cnbao@...il.com>, "Tangquan . Zheng"
<zhengtangquan@...o.com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v1] mm/vmalloc: fix incorrect
__vmap_pages_range_noflush() if vm_area_alloc_pages() from high order
fallback to order0
On Wed, 24. Jul 21:02, Matthew Wilcox wrote:
> On Thu, Jul 25, 2024 at 02:28:27AM +0800, Hailong.Liu wrote:
> > > if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMALLOC) ||
> > > - page_shift == PAGE_SHIFT)
> > > - return vmap_small_pages_range_noflush(addr, end, prot, pages);
> > > + page_shift == PAGE_SHIFT ||
> > > + page_private(pages[0]) == VM_AREA_ALLOC_PAGES_FALLBACK) {
> > > + int ret = vmap_small_pages_range_noflush(addr, end, prot, pages);
> > > +
> > > + set_page_private(pages[0], 0);
> > > + return ret;
> > > + }
> > >
> > > for (i = 0; i < nr; i += 1U << (page_shift - PAGE_SHIFT)) {
> > > int err;
> > > @@ -3583,6 +3590,7 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
> > >
> > > /* fall back to the zero order allocations */
> > > alloc_gfp |= __GFP_NOFAIL;
> > > + fallback = true;
> > Sry for my mistake, I forget define fallback here.
> > BTW, This is not the optimal solution. Does anyone have a better idea? Glad to
> > hear:)
>
> Yeah, I really don't like this approach. You could return a small
> struct indicating both nr_allocated and whether you had to fall back.
> Or you could pass a bool * parameter. They're both pretty nasty.
Agree. Thanks for pointing out. I send a rfc-v2 patch with a different solution.
pls help review.
https://lore.kernel.org/all/20240725035318.471-1-hailong.liu@oppo.com/T/#u
--
help you, help me,
Hailong.
Powered by blists - more mailing lists