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 A8023C4167B for ; Thu, 22 Dec 2022 08:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235101AbiLVI4i (ORCPT ); Thu, 22 Dec 2022 03:56:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiLVI4f (ORCPT ); Thu, 22 Dec 2022 03:56:35 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAD5F1D0C8 for ; Thu, 22 Dec 2022 00:56:34 -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-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=zifJKiMitrlfByU/WAVetRdSoX9cyLEqZ48bLhSjFoE=; b=z5juutT7hBzPnwRbRbqEy2ICxR bOwEe/myuE1UiHzUvAaVyYt8mUQ/nFTH869usF8sz1lWo+QnG/A/8WM8JpJNweZMFDzbEMvYNStvs ZqnjOjDWwdKLWL3UvkkhplOcEgNLOxsMV0W1OjMJ9q8vFZeyMsC2X1vEOpldBpH/hqeDJcRwSQ8wG X5ckuMnUIc50sBZ6XLh5zqkfCswR3LpCPBzd7Jjo1fBbLo0boXMMWqPWKksm/0bLPdNyvzHDpwtkE Ppsp24OTkxzlhMSVWnoat0izfAw8s0z/O15BtCmavvbXthst32mXP8hOiq57dYn1uunn6TpfRvpHI O7Ms1ARg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p8HNN-009NHh-IB; Thu, 22 Dec 2022 08:56:29 +0000 Date: Thu, 22 Dec 2022 00:56:29 -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 , Roman Gushchin Subject: Re: [PATCH v2 1/3] mm: vmalloc: Avoid of calling __find_vmap_area() twise in __vunmap() Message-ID: References: <20221221174454.1085130-1-urezki@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221221174454.1085130-1-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 A sorry. I need more coffee, this is not the cover letter, but the patch that introduceѕ find_unlink_vmap_area. > - spin_lock(&vmap_area_lock); > - unlink_va(va, &vmap_area_root); > - spin_unlock(&vmap_area_lock); > + if (!list_empty(&va->list)) { > + spin_lock(&vmap_area_lock); > + unlink_va(va, &vmap_area_root); > + spin_unlock(&vmap_area_lock); > + } As mentioned before, I'd much rather move this into the callers. > + va = find_unlink_vmap_area((unsigned long) addr); > + return __remove_vm_area(va); This can drop the va local variable now.