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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 B173BC433E0 for ; Thu, 25 Mar 2021 09:54:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CF7761A31 for ; Thu, 25 Mar 2021 09:54:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbhCYJy3 (ORCPT ); Thu, 25 Mar 2021 05:54:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:56240 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbhCYJyT (ORCPT ); Thu, 25 Mar 2021 05:54:19 -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 041C6AA55; Thu, 25 Mar 2021 09:54:18 +0000 (UTC) Date: Thu, 25 Mar 2021 10:54:10 +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 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. I might be reading the CMA code wrongly, but I cannot see any freeing up of memory in cma_clear_bitmap()->__bitmap_clear() (or its siblings). The actual freeing of memory seems to happen in cma_release_no_wait() with: if (count > 1) free_contig_range(pfn + 1, count - 1); -- Oscar Salvador SUSE L3