From patchwork Fri Feb 2 19:06:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 13543297 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 7AA36C4828F for ; Fri, 2 Feb 2024 19:06:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C18426B0071; Fri, 2 Feb 2024 14:06:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BC7A66B0072; Fri, 2 Feb 2024 14:06:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8F8D6B0074; Fri, 2 Feb 2024 14:06:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9A45F6B0071 for ; Fri, 2 Feb 2024 14:06:35 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 685BE40FA4 for ; Fri, 2 Feb 2024 19:06:35 +0000 (UTC) X-FDA: 81747795150.08.4E36B50 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by imf09.hostedemail.com (Postfix) with ESMTP id 8D9C8140009 for ; Fri, 2 Feb 2024 19:06:33 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OeOSRdcf; spf=pass (imf09.hostedemail.com: domain of urezki@gmail.com designates 209.85.208.175 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=1706900793; 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:references:dkim-signature; bh=EfyIjo6kez38DeVdB3upQeRKk1i+rP6oI+i6zlaUfoo=; b=FF/3KoH4Sju9qs68HT6ZauXDboNYQSDUAvT8GuAd+CSvl6l4RSVewvAiV120+2284TWQl9 5tmzdzkHV92zlwAHHFz6GBAH2jKd64Oq4UsQEEVueRj6so3s3pEp0T48ZCFOkOVcBB1QBO 1Y0/TNtPaV33VQIiG8tt/77PbalqdC4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706900793; a=rsa-sha256; cv=none; b=i6UYJvFwN7joGRnS5R3O9mXvHNNl5YllvyW7zTkoO5jS0+55cEXh+RvfYngk5GNvFo6MmH vePJSB72q0GfpIWn/ZaYFwAETu/fEgCWnFlXMIf8EUWlTIWTKqFRynj2qa2l5QJUgTUS5V DNN51/7XW+UTEDpd6K+cuSzcAZcidBU= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OeOSRdcf; spf=pass (imf09.hostedemail.com: domain of urezki@gmail.com designates 209.85.208.175 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2d094bc2244so2348491fa.1 for ; Fri, 02 Feb 2024 11:06:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706900792; x=1707505592; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EfyIjo6kez38DeVdB3upQeRKk1i+rP6oI+i6zlaUfoo=; b=OeOSRdcfxHRIQrycpBzKUlgAOD9ijaJMW8U/CxqizBRVuoJGW+kfW+Kc4zHTBK0UAg z1w+lBQufbv2Dc+uJfUVLpjU8lrBHPhualbgFkKuQ8YBpYW6RZaCqEa9QJma8K/5x34e 5cVOkvKVTU76naMaIegDJpUIa0Ik16Dek9sujPQorvaPDveg7CLI10yF2KduWjs7SsI8 ZUfKkq74Xch0I7/A6QkSWkE6tzhTC0MaXx0Z1gocjjsjAp8/63Xn83M5eq3fyZOb9hyy 2zF4xVdN8vbVVtvKFn3OgdA5XYnQc+KRxxfBhEcJqx1NZSEBqiG/hXrSkNjbpBfojd+B wAgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706900792; x=1707505592; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EfyIjo6kez38DeVdB3upQeRKk1i+rP6oI+i6zlaUfoo=; b=iUZ0foQvcwhcte09qFW4DVzgKFZ8AyBLFIcwHu1DGKzXgVVQW7Dp2Ja7QQvZVRShcP egMASu5sirlErQYY9hLdnmW5KC/9zjT8qt+mWAljqYrj/LPcWXyfedgujkMr1cOurjkH 25H75o7dczROvjD81hryy05GfygsxG3eKh9pcSl+85lDd4Z++VvoX/7y/x0l6tt4inj5 IXOOaEc8nM2c4cYoGAKUWuRIdk7oQaCn6dDDd73hyMUCRGEkSunhpGKxPD4W4Cd3IAI1 JkPyDgibOrNjlO78eQDBDIw3Q9P3EYfjgsOwBpaeTlQLOv1pd7az78R2+dTe8cpjZbGN EOcg== X-Gm-Message-State: AOJu0Yyuy4G+vn5jn7fF//LrVKbWQlGaDsmVqwHAolP0s+Bmfo0+4QWb DfnfSF88t1bP6jgc071kqs4xmSbyJXCjUOBBFrlaJ6RifLWFs3INah2HaWLX X-Google-Smtp-Source: AGHT+IHtyU5/7ucIPamzM379TcohrpY27WfOJr7P6Tq9bDYiN8E6PqLXwyXaVlVfe6ps2VVxllG9Og== X-Received: by 2002:a2e:a4b7:0:b0:2d0:7f95:1e3d with SMTP id g23-20020a2ea4b7000000b002d07f951e3dmr2445991ljm.40.1706900791373; Fri, 02 Feb 2024 11:06:31 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWEOqqB5uM/ZmiUeUdHWjO7MY/KcV6nzIPGUJ31nUcBeA2L7eQ9N5NI7fkF8C37YuahFUEd2kOpYu8x6WYfnpb/LDj2OYIBKScbAfzMBHEM480SJzArDdTwjCEFkR41eRK3d7T5D0kzUy9ofYBPgAbNNtq6PCoM/9PHOBczPPmSEANnI8kMIv4O+vM5CUo9O3rw9jgdL+i/lqZh055QYa+xlYlPObGucrdfAdlhrng6hgo4rc2i4rxsKo3uXHCSlrLokST19mc1Hgtl/ZXlHyDocYZdEVHiY0qIng== Received: from pc638.lan (host-185-121-47-193.sydskane.nu. [185.121.47.193]) by smtp.gmail.com with ESMTPSA id y9-20020a2e3209000000b002d0522b2550sm353782ljy.32.2024.02.02.11.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 11:06:30 -0800 (PST) From: "Uladzislau Rezki (Sony)" To: linux-mm@kvack.org, Andrew Morton Cc: LKML , Baoquan He , Lorenzo Stoakes , Christoph Hellwig , Matthew Wilcox , Dave Chinner , Uladzislau Rezki , Oleksiy Avramchenko Subject: [PATCH 1/1] mm: vmalloc: Add a scan area of VA only once Date: Fri, 2 Feb 2024 20:06:28 +0100 Message-Id: <20240202190628.47806-1-urezki@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Stat-Signature: ugt185eswhyp5d7b71fntot9fchhu3qj X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 8D9C8140009 X-Rspam-User: X-HE-Tag: 1706900793-473764 X-HE-Meta: U2FsdGVkX1+tzIl/pUAKp5ZfasXl15lrGa7ByhHNzw9GBVSqWvVQgyDOAasoP0dKaLSpRAC39Id1z7K+vwYKgfGJ/Mzyy4J/cRn9xE7v3aHf67Fa2GXcMdnHZ9UYw7jXEBOc/oOQlLLyfzu0K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Dsw4Kwuf3+rwIAWubqnzj4RLm0FH9JIft540vPxBk5OCXwSj7Q9cgrgoAaxMCOlh7Soxsazs2BG5fd6SvXIiiflQPZe/erd7CaCXW2/+3NHE166Ad4VQsRF3xdegUrbo4FeMcpDZuPTZ0ZDYoMXA8IpZQ35HMF6FMoCPK9af0obUbl9ddzQ1XKpO8SuxGoZaYQVvP74pMljPzqjz6dQWmi 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: List-Subscribe: List-Unsubscribe: Invoke a kmemleak_scan_area() function only for newly allocated objects to add a scan area within that object. There is no reason to add a same scan area(pointer to beginning or inside the object) several times. If a VA is obtained from the cache its scan area has already been associated. Fixes: 7db166b4aa0d ("mm: vmalloc: offload free_vmap_area_lock lock") Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Lorenzo Stoakes --- mm/vmalloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 449f45b0e474..25a8df497255 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1882,13 +1882,13 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, va = kmem_cache_alloc_node(vmap_area_cachep, gfp_mask, node); if (unlikely(!va)) return ERR_PTR(-ENOMEM); - } - /* - * Only scan the relevant parts containing pointers to other objects - * to avoid false negatives. - */ - kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask); + /* + * Only scan the relevant parts containing pointers to other objects + * to avoid false negatives. + */ + kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask); + } retry: if (addr == vend) {