Re: [PATCH 1/8] mm: cma: introduce cma_release_nowait()
From: Michal Hocko
Date: Thu Mar 25 2021 - 06:11:20 EST
On Thu 25-03-21 10:54:10, Oscar Salvador wrote:
> On Thu, Mar 25, 2021 at 10:45:18AM +0100, Michal Hocko wrote:
> > On Wed 24-03-21 17:28:28, Mike Kravetz wrote:
> > [...]
> > > phys_addr_t cma_get_base(const struct cma *cma)
> > > {
> > > return PFN_PHYS(cma->base_pfn);
> > > @@ -146,6 +155,10 @@ static int __init cma_init_reserved_areas(void)
> > > for (i = 0; i < cma_area_count; i++)
> > > cma_activate_area(&cma_areas[i]);
> > >
> > > + cma_release_wq = create_workqueue("cma_release");
> >
> > Considering the workqueue is used to free up memory it should likely be
> > WQ_MEM_RECLAIM to prevent from long stalls when WQs are overloaded.
>
> I might be missing something but the worqueue->func() seems to not be anything
> for memory related purposes.
> The worqueue calls cma_clear_bitmap_fn(), and the only think that does
> is freeing one page, and clearing the bitmap.
No, it shouldn't realease a sing page. That is a bug which I have
overlooked as well. I should free up the whole count worth of pages.
But fundamentally the worker does all the heavy lifting and frees up the
memory.
--
Michal Hocko
SUSE Labs