From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03533C433E3 for ; Thu, 25 Mar 2021 10:18:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B75D661A28 for ; Thu, 25 Mar 2021 10:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbhCYKRx (ORCPT ); Thu, 25 Mar 2021 06:17:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:47372 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbhCYKRi (ORCPT ); Thu, 25 Mar 2021 06:17:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1EC11AC16; Thu, 25 Mar 2021 10:17:37 +0000 (UTC) Date: Thu, 25 Mar 2021 11:17:32 +0100 From: Oscar Salvador To: Michal Hocko Cc: Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Roman Gushchin , Shakeel Butt , David Hildenbrand , Muchun Song , David Rientjes , Miaohe Lin , Peter Zijlstra , Matthew Wilcox , HORIGUCHI NAOYA , "Aneesh Kumar K . V" , Waiman Long , Peter Xu , Mina Almasry , Hillf Danton , Andrew Morton Subject: Re: [PATCH 1/8] mm: cma: introduce cma_release_nowait() Message-ID: References: <20210325002835.216118-1-mike.kravetz@oracle.com> <20210325002835.216118-2-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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