Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1031599rdb; Fri, 2 Feb 2024 11:12:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0ScEXbvWK9An2IUvscLmI4JTn18Nwkldl2hT8A3KFdUaC3k8TLze0RpceoRC9EciM48zP X-Received: by 2002:a05:6402:1659:b0:55f:fe3a:5c88 with SMTP id s25-20020a056402165900b0055ffe3a5c88mr407310edx.16.1706901137982; Fri, 02 Feb 2024 11:12:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706901137; cv=pass; d=google.com; s=arc-20160816; b=XPdYdP2H82XP39B9gR0evzU14IGP4UBsNjutb+SUlkd2BFTGHHs0gMrh1J7uNDvz6l oFRSKtkohZzr3/buK6iR3soTaswHwp6nO7E/UNUW5PFI3kU0B6PmauZn4GoqHmYigPxC o7+lSweAKm/plG91uYG41fUh/Pk94RvSdOJPwCORfawhJmBv70FxP+g+zzN4vuqrnvMg MZldDyTWjqRsqOSlPMBsxURIzNdxZR9nMTQ7CJotYbCXy5C7zCAMkxoZcGrpHb+OeyQX EJPwYlci0ig97zSkiqVz03UsEpEReo5YLkiSJOf+Tm1D/HYqjKHnIBZBjDPfwPZu0dCu n8XA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=EfyIjo6kez38DeVdB3upQeRKk1i+rP6oI+i6zlaUfoo=; fh=sUMtweNnK8r0Ojv4s+dNPOx1T9Z7V/NkytNOQW5b4T4=; b=gVYyTRclC0EJLQuKfeNhGLPDO8SHQcQysz3DNjh7xDGADegubPH3wMGBcj4NNgFI3R aomhfRzJs9DrcHloBtD/ii6NiIiFuSEelbrtplF1m5tEynsxsw3cu52SeBUbclHn7HGN ahq3oeYcvbJeSKJiC27o0HnQjy4kkij/3VqZJsCqR+OlqDscu6W2hzY9CctGN6MPDVz1 O/hm+awyr7befVtGi7KSipUP6x1M6wJGbks0SNDp+B6GHfyBBryRj7qeE6oOXhV8jpLk 2uELTfuMh5VyluHnzburEjFYucHQudoVnGJhS/t5Y9xugHEu6QgPcy5ilb5PbAm/l1qg Zxqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=geWC4g8l; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-50462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=1; AJvYcCVKNIxZxzyxNVULy9JkcPS9stm9DjjSowTC4ujFTvgiPJxl3vuexTDYZSLidzY01cAmxBMAyGsiEpDYzVB2C4hHhTZvD3OEOYYHkZ2fNQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cw10-20020a056402228a00b005591fde7b64si1063719edb.216.2024.02.02.11.12.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 11:12:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=geWC4g8l; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-50462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50462-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8A39F1F26CD0 for ; Fri, 2 Feb 2024 19:12:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 41489839E1; Fri, 2 Feb 2024 19:06:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="geWC4g8l" Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C395F839E5 for ; Fri, 2 Feb 2024 19:06:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706900795; cv=none; b=nDUajgRocGN8/xumc5JrxonRkynRICd2M9lvrx3D2QT81vItiTakS2ltwd2YLsgpIQ8GwuwO8TfPYuCOnZqsr7+jsFZcTGS0oDO6k140DS6qgyLQ1dSRwvkxyTN3sssYzuJapHAiBSF0ifUtAesXO6noIl/F44q5dAo3gveF760= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706900795; c=relaxed/simple; bh=rNWqum3/yYvzJfhaZjhWCaFc1cTDx8Mx6rzWVIVoCyU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Z/dpxp3+FAtTW8O2oIfJv/luEru16U4n18O0sYCpKYO3R66tX5nmHoS3upIYPPFz7atVUrhMsXFgnX+ixngRtCgXxu791TM43tY2/F+eMIOcFv1wVrbDT4r4CqnQQH08Wyws3WSIueJgLifB+nRkQkxvj76AOiVHbc3h5YnNG6c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=geWC4g8l; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2d081a0e5feso15508971fa.0 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=vger.kernel.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=geWC4g8lliMc722fjCcD1BWfvohFaoXqVb9Be3c0PgDO/PPR9eoZhLU01u1/3H8dVD ET9ND7Wm7Jdl9UCfYLXrVfXzFqm9QO0o5i/HWY2IvgWRngKMa5vdFMgZ4Ol333oC3ZOw 6F6BNFz0NCKZoKbmCYTPy6Vl+51jEF9Y61lYab/YWImHfQHzcOr2zXIlcaH1OmGRqWtO B0PZddapIxsQjjqrGM678GmZLtAxof5KDbWjnzZaGSyfrLdNEQWo4O5l2GCu0hN51z+M ugay55elXL5XuDVjfm7swTj6HuuCEC95cg+g/WDsHt1lH1eZBc+eG02sFyxg5u1LygC9 QZLA== 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=ZFZt0Ol9HH1FA9oa1gmFKO3D9Qt1ED/K+tFsJtaJo6q63RD6dNc+tupmHl3LX591rt injweMMH+WFC2a6aZ/BEa5Dd2PfSJ3YoSX3qPEml/HFdZ87xkSlSmArAVmGmbouD44tJ w7IhLQRiVGcISBJ57K19hEB79QdzsAVIC4QV6mmo+U4bF58BDrKPOZ4i9nd6arL7EAP4 paYqpVFnzcVZH8H96GbfAVt5RzlUgo1bUgQSDbpUdz7eG824YypHwj1RtiMbflwDZ0hX y+s2pRumIy3jlWENOFF9ABDuw39SjNlSOoPXh4jr5HL4tl66QnOwXf2RVxY71qoNBz6V 5lQQ== X-Gm-Message-State: AOJu0YxTal9+1iA+j24pFBjeVddYvBRRvf245p+tXC/0E5I55EidjYjw Ueea0JFQcA/jHs+6EpffEMgRMXyQyQKr+mioGaduBrmUompqTpKU 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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) --- 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) { -- 2.39.2