From patchwork Wed Dec 21 17:44:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 13079009 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5506FC4332F for ; Wed, 21 Dec 2022 17:45:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B206A8E0003; Wed, 21 Dec 2022 12:45:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD0FA8E0002; Wed, 21 Dec 2022 12:45:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 999368E0003; Wed, 21 Dec 2022 12:45:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8CD7A8E0002 for ; Wed, 21 Dec 2022 12:45:00 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 44293403B7 for ; Wed, 21 Dec 2022 17:45:00 +0000 (UTC) X-FDA: 80267039160.14.49808CC Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by imf20.hostedemail.com (Postfix) with ESMTP id 89D8D1C000C for ; Wed, 21 Dec 2022 17:44:58 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BOkkSj8G; spf=pass (imf20.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.42 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671644698; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=544etTN2zsLy2RuJnjdxp9kpPg16kDUmBRROWQgCx4I=; b=EwNYn7M/dElCqUVNr2Hx3jgeWXVrVpbp4X9r9/PNW4sGjJEmXP1gzGtyXMXUoyWHwFH8Mo 4wyN/+BibKV370XoP/+jCbCIbMIMLT+8A20eTMrwGxZhLMtk7yfliTiFQd+zG6hhwQ5+7t U/J3fjFCII0ehXlW7epVKDB1fsm/pvg= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BOkkSj8G; spf=pass (imf20.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.42 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671644698; a=rsa-sha256; cv=none; b=KDv4PcX/e58xdA15+26oKRgY0vpUOJueyRYtw2YlyHkD7WXsjw2fLMHG6mjk+5EOlR0iKX Ej+QDp64TrrHjAon8dg49OOrfofNCeQpBkTjeuQi3LxbgrkJdXgRiyaJCSXXg8psDoeRKp +utvgTADtAvecqsGRNWpozooBtmM3gM= Received: by mail-lf1-f42.google.com with SMTP id f34so9380180lfv.10 for ; Wed, 21 Dec 2022 09:44:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=544etTN2zsLy2RuJnjdxp9kpPg16kDUmBRROWQgCx4I=; b=BOkkSj8GfNQTDHhyrFcn0I/nzedv1dEd1KOPyb8qyCjqL4R7Ob9ZtFrGu/Ybe/ewJF ZmGXGIDcN8J+NQ1p4qaFZ7gxdg0Wjd0aFZYgWv6CJtKALROMkPC3tvN3e3pPqNQcyGaY JU6bOj0Pc1+JwwTIEfO4D9onySWHA1QC/VZumjpFigrfTWmOXO5rpj3xBLPDbADsrfnZ QvR9I5coGxquW1LfTsPUpghKJeZpQAk3phKWG367TrGUXdOa7gLvO37kGtsOPA7Zevg6 YfAE3MXVXednaBs2917MzU6urWoRyKNRqQd1rf7E8Pn6GabfkRi/1T7PFJ8lkNUoAqOG xBrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=544etTN2zsLy2RuJnjdxp9kpPg16kDUmBRROWQgCx4I=; b=kDLDhxF5LhJnyAuZtjRKo7Kt5XZYHIf2Q+HNwGZxfZq0Q6fXt5uu4QByLMbmPNlRV5 eQFOY+qeI2W1urCGDz56tAFDfOC/LkdDjc77kGD1CL722FxheBgffcRPBACufAD7cGTa 0IK9ll0sWkqDVErICsodOue21LH9nB/46bI7bvvEFuKmnJ6kY39kYebPSiikul4wcYaA YLuAL1yopPOi3j8s6GaCKQG7DuNvMcgOZvvoV9t5bba0ww7S4f1ri9dGNprBmIIsBdGp ZcMEHlunuIYrI/i0HnKvqbPTcCOBCBLY42UOOxaiZcMGjdmYGDOn1MXeg6z1QE9xCzNa BZ5g== X-Gm-Message-State: AFqh2kqlqvdPhKy5Mi2WL05h4K6bwZ1G9g2RoXrOjLBpak9F54uUhCmP rOkhv0IvzKQKe0i1SI8oRXA= X-Google-Smtp-Source: AMrXdXvH8wAVdlO1kFdpPpNCE8zm69xdiqCJVUw6EzElonJPtrOpsedL6IUbSLLGOH2j29vr4ZWoqA== X-Received: by 2002:a05:6512:3ca0:b0:4b5:b7c3:8053 with SMTP id h32-20020a0565123ca000b004b5b7c38053mr1021482lfv.42.1671644696863; Wed, 21 Dec 2022 09:44:56 -0800 (PST) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id r18-20020ac252b2000000b004a91d1b3070sm1904915lfm.308.2022.12.21.09.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Dec 2022 09:44:56 -0800 (PST) From: "Uladzislau Rezki (Sony)" To: Andrew Morton Cc: linux-mm@kvack.org, LKML , Baoquan He , Lorenzo Stoakes , Christoph Hellwig , Matthew Wilcox , Nicholas Piggin , Uladzislau Rezki , Oleksiy Avramchenko Subject: [PATCH v2 2/3] mm: vmalloc: Switch to find_unlink_vmap_area() in vm_unmap_ram() Date: Wed, 21 Dec 2022 18:44:53 +0100 Message-Id: <20221221174454.1085130-2-urezki@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221221174454.1085130-1-urezki@gmail.com> References: <20221221174454.1085130-1-urezki@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 89D8D1C000C X-Stat-Signature: 5zcu3rpfb8eoahgr9jt1mebpi7coxbnh X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1671644698-458979 X-HE-Meta: U2FsdGVkX1/+GZFhUEDL2kPNF5XE7nBwi+JzCP14o04MjGnqOiSv0587HXTyPvqmTg6UB/nLHTsjCK8EGMeRPiezqdgGcRpMcgLPOIAJ6CPhOV0/VqkFg8jr0j205LLAwSJRsPbqRpb5n8t5RfvmJBmOi1BeHwdmDYrZY67AHO3azpOV92LiZDYhdA3lU3VeoctdOwQrjGsApXAGqVCl7YitA4bwAn1io03xqmpNwwD+cfnOjJZXhDO+VR9WPDBff74BDsQtT0DtTcJD6MXmsvdHP+9E8PMn7TJnZ9voORTI7pWQMdWTU96FxLtf/MBN8WEWwzhf3zGc1doK4eqU8zN7r1vyVAYf3JXOW1AiDPFvAM2Jo7q1gBxAkmZ1XbcwDLbnpt7lWnyzA9V/7mSrpopyqkU6CoD0g4AD9v0Zgb8eWCgfZo9d9kVQdv5C47IgUUkoIkYrAq/WFCG0TZFRmsQ/h7vo0SDD0wJjmJA0eHab/0jjxRqUOn40hOdV4BDv+qaUCuVk2xsfaoo6krpmeDZAfYZ6gVrCG6IRLtBx1d0vI3v10zM1jCEq8CTLB9f6LO33rCjTjDxAhRKgFVJjMxPxk6y0NHDmwZCGOj/RXw4GEcClHgfGrKNDAHgy353uafUbVoyPpGqNLatdBbUUt/lY1kc+pwDN382x4OuU43npMxH+UYQeeSDhYys5yIsvfkQ8u1IfuHTEZMXiHTUS6NoaFGNaie12etXZF1UEhvYut/mkhUGFCyp2L42lglO6TN4Gdx2m+Rle+to8ndajzVl1Mce3BqiV2y90PvjYq/lGmX9UQss2Ov+tPKy9m3Q1OtyDGU1wqFIHwtqDv7VXK+xOM7UiLfke2aJvP37CKdLMBFcDo0qQ56TeMOo/Y3nuGC2BT3vIaYnp5yYxMbZBF+GwjsOn7rqFKboVoSfWnqIYWsmubzfh7B7lFK+2/lvVeRPZi7XVh9HBPIHoUEc RhOze7Py 3IYaXQ2YZ7HQx7ORSPFQ52ifkTM6TwVCOMjPJ87FBJrTSWcttDVXkmfvnIrK791Ca+51X1DsWxyIRi6Y7XQkU+GJRA2lvoXycbgS0Q4Ph4M8/QBi5nrYV6gQIE53OBwTXojnqr+iayf+19QHgfHLdVISLxwHJIfd1unyiBQqYMJ1IFKU= 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: 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) Reviewed-by: Christoph Hellwig --- 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); BUG_ON(!va); debug_check_no_locks_freed((void *)va->va_start, (va->va_end - va->va_start));