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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D911C001B2 for ; Thu, 22 Dec 2022 08:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235156AbiLVIuf (ORCPT ); Thu, 22 Dec 2022 03:50:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235149AbiLVIu1 (ORCPT ); Thu, 22 Dec 2022 03:50:27 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3453726A83 for ; Thu, 22 Dec 2022 00:50:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=dOUwRecl7A2zD8gYlrrUSxjb8W4DwBivGT1G7NGZMEA=; b=COjMi5tBEGXXCeUCKH0jcI18mO W/UO8pS5kdDQfbW2+IrMbRBfiFQNml8i1OoM9e8IWN0o7Z1u6xR/JwJA1X581wd1J6N+vIEloDaWH IXd+2/qh/IsKESe66be2BHAePUhoVkfqfAHSQ0b0W98jVqTbc/R3mYXxPIuNT1sVmSgRD044n54aL NL9syzue84c1xPfM/gLScr2PaV9USuaksQLFAwY6YDhGluxHEWSASXwI+G8iDJX/QS/fRBnTPse60 tqKnJ3vvHnFvSEVjErA6OL3HD9yC//mzMQ6/JDbcegljaL4mFGp5knyzIdlQkfKb8DFbtI6R/UaUz Kz3Kd/FQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p8HHS-009Geu-74; Thu, 22 Dec 2022 08:50:22 +0000 Date: Thu, 22 Dec 2022 00:50:22 -0800 From: Christoph Hellwig To: "Uladzislau Rezki (Sony)" Cc: Andrew Morton , linux-mm@kvack.org, LKML , Baoquan He , Lorenzo Stoakes , Christoph Hellwig , Matthew Wilcox , Nicholas Piggin , Oleksiy Avramchenko Subject: Re: [PATCH v2 2/3] mm: vmalloc: Switch to find_unlink_vmap_area() in vm_unmap_ram() Message-ID: References: <20221221174454.1085130-1-urezki@gmail.com> <20221221174454.1085130-2-urezki@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221221174454.1085130-2-urezki@gmail.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looks good: Reviewed-by: Christoph Hellwig On Wed, Dec 21, 2022 at 06:44:53PM +0100, Uladzislau Rezki (Sony) wrote: > Switch from find_vmap_area() to find_unlink_vmap_area() to prevent > a double access to the vmap_area_lock: one for finding area, second > time is for unlinking from a tree. > > Signed-off-by: Uladzislau Rezki (Sony) > --- > mm/vmalloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index 28030d2441f1..17e688cc7357 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -2251,7 +2251,7 @@ void vm_unmap_ram(const void *mem, unsigned int count) > return; > } > > - va = find_vmap_area(addr); > + va = find_unlink_vmap_area(addr); I can't find find_unlink_vmap_area in current -next, but shouldn't this also switch from free_vmap_area_noflush to something that doesn't unlink from the list and avoid the lock? In general the code could probably use a bit of refactoring to split unmapping from freeing.