On Thu, Mar 25, 2021 at 11:11:49AM +0100, Michal Hocko wrote: > I have overlooked that > +static void cma_clear_bitmap_fn(struct work_struct *work) > +{ > + struct cma_clear_bitmap_work *w; > + > + w = container_of(work, struct cma_clear_bitmap_work, work); > + > + cma_clear_bitmap(w->cma, w->pfn, w->count); > + > + __free_page(pfn_to_page(w->pfn)); > +} > > should be doing free_contig_range with w->count target. That is currently done in cma_release_nowait(). You meant we should move that work there in the wq? I thought the reason for creating a WQ in the first place was to have a non-blocking cma_release() variant, as we might block down the chain when clearing the bitmat, I do not think this was about freeing up memory, or at least the changelog did not mention it. Also, IIUC, we use the first page to store the workqueue information (we use it as a storage for it, in cma_release_nowait()), that is why once we are done with the workqueue work in cma_clear_bitmap_fn(), we can free that page. -- Oscar Salvador SUSE L3