Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp48558lqt; Wed, 5 Jun 2024 16:55:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWwSRX3EoXd4qNf4R/kDDQtqngpnNhlEVghecQlpjpzLF7XOxE0WD7QNQYQSfivjsIy3aCWJwoGiMp7sUwm/0N9rXCxaHDjW7MXIHcOBg== X-Google-Smtp-Source: AGHT+IHfqUzj97b/ViDx44VkdvUNtIm8PXplCoWEsxQzuejdg6bBLed508xujEmi2AD9glGKPwWQ X-Received: by 2002:a17:902:d14a:b0:1f4:5088:33fa with SMTP id d9443c01a7336-1f6a5a07022mr31710265ad.19.1717631749092; Wed, 05 Jun 2024 16:55:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717631749; cv=pass; d=google.com; s=arc-20160816; b=W12fUO8iWzfMaDvK9Ozg3du0c6UlTzHr4x3/BQ8/zFY7GPY/CsUbLdoVunsUApYEb/ d3q7p7GcL11RMN3/MG9VOe06RORpj4Kb5iLyQTIj2mWG/8RPsLmUa1m2RSh3ej7zDJmk r1z/SB/0RVxyjYah46bmqBRJ6WRZZ5Nq9hwX6YdAxPAqgbmCLSvK42zYjRFbdxNXGC9O vXHwWegIEDTN73ZwN752l4v/prrRsJSXLtfGo0EBqHWwiD8/bhpooKBIM5dew0hmUHFf /1W01GjCxOSurpsyqe5j9fgdckLjyYq7eJ0LQt7ca0423MzE6w5i1wfrneOGUOGpVApY A8JA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=SOoM7UFhwQ7QR/s5c6/iMqUtz+xzNojBCRoqDAeYHPk=; fh=aRddDEddcYd1e3NK2OXe32UzRi/jj3i0nwMfrrWYetw=; b=bCgKrcIs8n6Rzr2J31HbTPuegO8ekqF9pJCK77QO1JZpmp20T61xL7OecCtwifweQD Li+hlhP2EoxavacdXhSkf+/J1oKOqir9nUQbpvyEuII/Y0nOD5v5vOTJ3R8qmmNisf/F pmc9lpU9BqRGdIeKytpqLqPcOG/nrLYRo3KmwxkPTz9LHBecKOgliV5y0LoYC/wp5aP9 vJj3JtCwkEgYVmm/kAx+0tg3wEYIxNRpeSCczLSsSfwhRGuioQR2HK0IrtKZM9/Nzm4/ 0SmBJNOVgZ7nAeyfeaFNsMdqGk79RHWtJF9z4pslRH2lqYwS8J2ei8hxPg1UzbaBLTLi 16/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EP8zK+Dr; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-203436-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7f3102si1546615ad.454.2024.06.05.16.55.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 16:55:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203436-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EP8zK+Dr; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-203436-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B661A287989 for ; Wed, 5 Jun 2024 23:55:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A77D916938D; Wed, 5 Jun 2024 23:54:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="EP8zK+Dr" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 7D9D5168C2E for ; Wed, 5 Jun 2024 23:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717631694; cv=none; b=DZ/sXu6YX1MyYdzF7BlU63XEGPcXgA4Ouj649fK8RZKAwV5a6n/2CWvLODHlIC2NEonvresse9XYLChmovvun+d+NFtHbbJI9Nh0PKaO1FBZJ+zGfMERvsO3h+dDtXkTg/GmeLeURbkm1AKwIBTFTeeJDBlfG3tscTayCouI1C8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717631694; c=relaxed/simple; bh=Tk/gg4Z7m8cPwkqUMSj9bxnEXvLbAVNGUl3GAZ8QhMI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Content-Type; b=FWyS/2riWUh9eSOv+SGKCI3OCghNPFQpaVCIZ+7So6gZy8fEUUwxl3aNHP01IjsO7QpfvyK67LDDv8siMJw3j3QG1X6fvY9V6u2HkFEVR3nrv/m+TJMxOuIsBAHpNN0lkJxTedzmWAHO0uahbszEClSNxXaE7fl7mI0R7f9ztKg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=EP8zK+Dr; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1ee5f3123d8so37085ad.1 for ; Wed, 05 Jun 2024 16:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717631693; x=1718236493; darn=vger.kernel.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SOoM7UFhwQ7QR/s5c6/iMqUtz+xzNojBCRoqDAeYHPk=; b=EP8zK+DriFdNMatQenNp34Ulk+MxOi01IKpL95Jqh9c2Q63NBrPkFcwR4D5oy0MDIZ AjWCSLzzMxUYB/qSRIJ6Yl07cogcN140pppAtq65uReCuEDsqr9rcAJmt822MI4eKI2F lNtwwbRXMQ2Dap3MVwuRuYwsUmIP6WwbYyW47p4Nghfkcp5l9jPwcYW5hwyBBDxgohXn TeMLvRR46CnMk7/WzjS/Qbm6+tUsJ4N005SUFnBE6WP8lF7JM0xYEt18I20eix/18CPm LBr7HStQFRI4L+ONGYP0XCKbwv7p7mzDweQItz/y1A6LzqPldN4pJi7ALFFR9WxnBKKb zj/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717631693; x=1718236493; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SOoM7UFhwQ7QR/s5c6/iMqUtz+xzNojBCRoqDAeYHPk=; b=Op0dLZIJN7Ayaj5DYVFYJMhEal1nIrthLuJLhnzknLq7HYzJecxltfoLrJ2U5e9PC3 EBuD+CxdWd74b/YCJ2h+5T+UJ9ZZE4IVgJC5A32C2o/IjqngYb/ElYvKKMtG86LxlO87 fJT+fv/4WDI2urOMj1at5Z0x0Y0Fe64rgDXVkedqVWQ6YmFYnuGgFGzQFTwtMzuvydm4 CJVNzT7qXBN4IIa4Ln/6CbwHYopXMyQYi2ECteBCoNlsT4T5qrxZKk55hpUaXUmHNYlR uObS0ao64tjU6g6mKuUblcjY7L5lj4CVNIsM9EqlRIk8fgyg9oDavXbvhTrQxzK472P+ xM4w== X-Forwarded-Encrypted: i=1; AJvYcCVVo1KhZoxVHIrDyFb6DYtpRyJvV8NYA2DWqWvcqgG/1kmvAmB1JrkHcAt9/WwSAksehYEeluPty/BMJJUppCWrWLVjSgbmiKx880ND X-Gm-Message-State: AOJu0Yw1qtadLgYbDmYkMzCet/xAjfQXz2VPsLtia8k+BrGuIt+KBpNY MyJtVhL6lP29RyE6mV+GRyxWA5oLE4DdQT8Zp0blEewTkuTeg8Iv6pV3/n0bFxuVymyNeNiE2wU He3cX41RdK/3kB5pDAkzAnqBOaBpVVmRYzj9W X-Received: by 2002:a17:902:8b87:b0:1f3:2b46:47ce with SMTP id d9443c01a7336-1f6bd3a4268mr711265ad.15.1717631692204; Wed, 05 Jun 2024 16:54:52 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240521165109.708593-1-irogers@google.com> In-Reply-To: <20240521165109.708593-1-irogers@google.com> From: Ian Rogers Date: Wed, 5 Jun 2024 16:54:40 -0700 Message-ID: Subject: Re: [PATCH v1 0/3] Fix and improve __maps__fixup_overlap_and_insert To: "Steinar H . Gunderson" , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 21, 2024 at 9:51=E2=80=AFAM Ian Rogers wro= te: > > Fix latent unlikely bugs in __maps__fixup_overlap_and_insert. > > Improve __maps__fixup_overlap_and_insert's performance 21x in the case > of overlapping mmaps. sesse@google.com reported slowness opening > perf.data files from chromium where the files contained a large number > of overlapping mappings. Improve this case primarily by avoiding > unnecessary sorting. > > Unscientific timing data processing a perf.data file with overlapping > mmap events from chromium: > > Before: > real 0m9.856s > user 0m9.637s > sys 0m0.204s > > After: > real 0m0.675s > user 0m0.454s > sys 0m0.196s > > Tested with address/leak sanitizer, invariant checks and validating > the before and after output are identical. > > Ian Rogers (3): > perf maps: Fix use after free in __maps__fixup_overlap_and_insert > perf maps: Reduce sorting for overlapping mappings > perf maps: Add/use a sorted insert for fixup overlap and insert Ping. Thanks, Ian > tools/perf/util/maps.c | 113 +++++++++++++++++++++++++++++++++-------- > 1 file changed, 92 insertions(+), 21 deletions(-) > > -- > 2.45.0.rc1.225.g2a3ae87e7f-goog >