From patchwork Thu Dec 22 19:00:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 13080238 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 473E5C4167B for ; Thu, 22 Dec 2022 19:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CF94900005; Thu, 22 Dec 2022 14:00:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 65802900004; Thu, 22 Dec 2022 14:00:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D3B7940007; Thu, 22 Dec 2022 14:00:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 30A13900004 for ; Thu, 22 Dec 2022 14:00:39 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E733C1C6727 for ; Thu, 22 Dec 2022 19:00:38 +0000 (UTC) X-FDA: 80270858556.14.6D5574F Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf18.hostedemail.com (Postfix) with ESMTP id D93D11C001D for ; Thu, 22 Dec 2022 19:00:35 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="bcrd/4/x"; spf=pass (imf18.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.49 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=1671735636; 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=i+DOrKc/WLcF8tZORAcZxALx+GbVZfz9pT9WtlPUuC4=; b=O75LikEXijioAGXmDm2WEQ43/hp3yRU4f2DcgBTZxjUZln3w020btGYd7zzKJVFeh3/OEr FfE1ntzP4tIojwQo5pI7ybfveKbshNQthv9DSnuOwFu9JyCj5WMsFXwgxNJDfetubeMXJu kJJ4wUKBPDHGeLPyLAj+EdnnQ6frTWU= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="bcrd/4/x"; spf=pass (imf18.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.49 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=1671735636; a=rsa-sha256; cv=none; b=EA8SUkK9qWqKXl9Z0YsZj6GB2wHCz8Z07X4WCeoIirwdjOnBu9VPoj/Y0EpNBsWfpbj5Ka EkZHlGpRH22RHhgINO9Y5RHx8ln6uUKI7IUelQaybszAhkvRxcuc9lhU69iRTuO3n1T8EY 0V/0zlp1qyuOQlTjvBx/PEm1/ckj0xg= Received: by mail-lf1-f49.google.com with SMTP id cf42so4101212lfb.1 for ; Thu, 22 Dec 2022 11:00:35 -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=i+DOrKc/WLcF8tZORAcZxALx+GbVZfz9pT9WtlPUuC4=; b=bcrd/4/xejvVpq2+B3spoa/sbs9+HPre0M1zqgfRI4dfY5E5LLvs2Qh8ug58GxtUlS maVwcN/m+756UH2rwsGldqcaBBY4cgnAT1gpT5r67UCTO8byxZzI1h7F/Z4hd4dD3OMI pwjn8QOFoRBrS4dZPFZk1GAW7LFmW+QMvJqP19G0NtyH5b6iXpL67h0+kV8VaNk2h9DJ cmBkv3h+DmAARSsdpskD45XXO1BfEN/S2Pc4Ypcd8ACZ7ZgK+xOC8vgd2bX7/NUMoEH7 eL3xq2h11ZhNpZ2t1u/eQch2Q5E6nCkWHMmqAyYutaSnLMFckQpTER9Z80Z3zQ5VEVF1 ky/w== 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=i+DOrKc/WLcF8tZORAcZxALx+GbVZfz9pT9WtlPUuC4=; b=R+wcues/eVAAo6keT3Ktw4TWKhMa4Fhjwq/Oj79Egpqnp18LXQyH0PTiLB9cpEr4Q9 nJ9Fa6tz3x30IYgnim2HUxAY5gn09eWQ4nI6f4bmwcJphKt1BxI1Q6b+TL6R/2juI6CR VuyGd1R9XbyUd+kdPcJYtOYgtxMmaviiRrsjlxYbDKOEJiF797xvCGq6Y51xGDExyhnS U3oh4TiEuPpmHemOLiO9b2M3ixDpht3bpM4tINcNMz2hcjkkgY3lih2hSot6P5DyxPzj xI3BbStPx0LCK9S3uNhvamvGHylE0Z09hRaFbJRVKMNI+5mMC9qVX7JgB5SY15TQYown Tq3Q== X-Gm-Message-State: AFqh2koyThCN+239AvOkYC6vQhfb+x8eJkxgVuSM1j2jHGXH0xj/ZV5E jDItpFZj/4YbSXyPFhcawVA= X-Google-Smtp-Source: AMrXdXul5bZK1z5ZO6+wV5M1B4ckWgEp7djYnY12RmpTYVoVITC2Do/+E8FCHd6bs5YsCMrtD5VgnQ== X-Received: by 2002:a05:6512:b9f:b0:4b5:9914:87f6 with SMTP id b31-20020a0565120b9f00b004b5991487f6mr2162013lfv.66.1671735634218; Thu, 22 Dec 2022 11:00:34 -0800 (PST) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id c20-20020ac24154000000b0048a8c907fe9sm164209lfi.167.2022.12.22.11.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 11:00:33 -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 , Christoph Hellwig Subject: [PATCH v3 2/3] mm: vmalloc: Switch to find_unlink_vmap_area() in vm_unmap_ram() Date: Thu, 22 Dec 2022 20:00:21 +0100 Message-Id: <20221222190022.134380-2-urezki@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221222190022.134380-1-urezki@gmail.com> References: <20221222190022.134380-1-urezki@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D93D11C001D X-Rspam-User: X-Stat-Signature: 478tdeeuahbrfuw8uf6tsfrmpjwminka X-HE-Tag: 1671735635-535244 X-HE-Meta: U2FsdGVkX1/rvpDQUd1+u0cNpdEfdVPaDpvzq7Rf5usqTs6bcbosL0lTdCIeK0YorUBKMzxdCIu4/H5NE7pgzBmda41cpvuoLWINE/HUrFW9lQqb4VsxpVsIF1XsYEh5iyhxYcG9GFX79lXHXVAvVd4mw5kNRGeqH/eNt76eGY9fegEL+Xg6gxH9JnI9HaPWwRLByibljfxthZnn2otGGQHxaGPSskne0Oe2b6jQdhoJs/EeNEqkk3ZZbbLfJbl2qJE/l4SMwVBo5ZcrAkCV7/wvMM+y9FsWTrNqp6QChniuDh9rvf8xHbdozZ+a7CgJ/BdZvG3pNJDu9VQFIumYI0XA+JWncPds+3wGPzX45omVX7biPSrYwH+m5ZuVh7xjcgvQnhuKQk7KayYIBB5okLwqZ5SXuttnl3cpfNh2Cn3fbV2DWs5Pmj0JzvtPzner1mF5Wdq2yJPfVgAeOeuYddjfC2D7GUUluB/nEKlH3TqDNCnYUXsVC3mzAqQbQZtdbqk7LZ2Wxf3pV43mKsLKpUrLHHLdeLVWpIjfDL4mZUMXVKdDfIeGVXUXT/mKBEsZ1m9NDCeyNllwLaEqzTXiSO2dNzj63ru69ntsRMnA2SwEHP59hyIvAyi7q/rP56AxDIC5svK4lgXQ8cI/6QAfRX4R6pzL5IcAn49nXdGWHGGgeOz9e/UjsaSwA+ZVFntRYwAdxxhK4TD5Bo8JqvnBJnIoWtIw4qhfwaUGOBr9n9Hyjz3uUn84R8C+S3k7pcmnhVhQA68yO2+QTRDhdUYbId6XkY+B2SJU5QEAxrdk4n0ZES8N8DYLrd4wSluO2sxiUN+t8pQn6Jvt3RV3U2Cvgtar8keZ91IG0d19F7lSofZcRCjsO+MLCtnghWqKVmX3RdPIYFkP6TYldIzdkyBXsQiN9+8H+EKaP7qj2jjMb6DDrLTK3+CDQ/BJBbK7abUG6w/AoFG9/MnAvXja/Lm a6xe8klp mTyI8zf9UiBnkIlh5BJsIuK2EQGiDr1RnA11yy7YKheUSBuBRS5SrBpaWLVrwPSY6jsG83PK0rG4/YZ+Hezmtu6DDA5BW9kWHC1Ww8Cx9PLUVkeE1wFLnmAVrXo6Z3semgppxQdekhsn3kmelBS+7H5LXFMLRf9UmS8YdEvRIdGTa/mQ= 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. Reviewed-by: Christoph Hellwig 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 eb91ecaa7277..70e5000b9d68 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2252,7 +2252,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));