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 96174C433DB for ; Thu, 25 Mar 2021 10:17:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 01A0561A10 for ; Thu, 25 Mar 2021 10:17:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01A0561A10 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E9496B0072; Thu, 25 Mar 2021 06:17:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C0536B0073; Thu, 25 Mar 2021 06:17:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 488076B0074; Thu, 25 Mar 2021 06:17:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 2C0516B0072 for ; Thu, 25 Mar 2021 06:17:44 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D91EB82DE662 for ; Thu, 25 Mar 2021 10:17:43 +0000 (UTC) X-FDA: 77957995206.08.75BF0C8 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP id 01780801AE43 for ; Thu, 25 Mar 2021 10:17:38 +0000 (UTC) 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: X-Stat-Signature: jtyxcaayju87ou9pbjpac38ctkkwb9t6 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 01780801AE43 Received-SPF: none (suse.de>: No applicable sender policy available) receiver=imf08; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1616667458-336175 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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