Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp187800rwj; Thu, 22 Dec 2022 01:18:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXvjNEhqfu8Uu2gaKrJDJ9tbp1YhrHQzPIwpnjmRVc1ND7/yWaRNQtftkdTH1kE8rOE+mEpE X-Received: by 2002:a05:6a20:3ba7:b0:b2:3174:d2b2 with SMTP id b39-20020a056a203ba700b000b23174d2b2mr6060149pzh.28.1671700692866; Thu, 22 Dec 2022 01:18:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671700692; cv=none; d=google.com; s=arc-20160816; b=aCCXJBegwM6n+pASYnvnAWEy78UJkFnztwrJCemg13Jk9LWmw3prhuzI/Zs3tYe6E2 VBp8CxhAX82VizMk7fZbjqJFlVCiP7YYpwoe6O1yzKz5crhCF8n9AmPxR6Jx5YZDs2kI UE2kuS4WQsxfo00AJaU/SArCSTRzUGeyU0hLFQ+InohS4XgBKAGFsOQMGrvQCOrKGt14 KmcsA3QyOw8XUL+KDHNKGqnYjKmKKJNIZtyWjVNFsR2i0Cd/VYFiML3BIaWHPKp7N8OI w9xlZwsiYFN8OZVVb323zR+d9Z5QyIr0UhdlvzwOgCWSJ5SnAnD9rxpEatXYKfcmrVLB HEDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zifJKiMitrlfByU/WAVetRdSoX9cyLEqZ48bLhSjFoE=; b=wTtklFxkAT5GrYoAD+A8rZkOEyuGzzUqW47MVqIB2IuArwFs5OoUcWSpmzWZYfU+wh 948cQm7y9o1tZuLsFGbUSwfydRuWTwtpZ9Q0pLmWg0dbbEWc8xcy9zzaiPT7Y81sjrjm e+Le6mFivTrQFvpiAm0LQwYVUo+pNm1YGDIxFjfJu2kuE8rR+5zfvwpjXSUFEbu99JI5 ya763gcKG+By1wHmbwHb0+M3O6P6M6rTpRDJNhaW5+QFJtKHsook/YbXX05sS7iZlzc8 kiISpGjBBzAcdztZg740gVFPZq5kiE4vbfAz2lQeJzKnzHouNL7u/mVbJ2zNHzJCkivO BAcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=z5juutT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a635349000000b0047907294f9dsi271763pgl.670.2022.12.22.01.18.04; Thu, 22 Dec 2022 01:18:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=z5juutT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234953AbiLVI4h (ORCPT + 68 others); Thu, 22 Dec 2022 03:56:37 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.