From nobody Sun Dec 28 15:36:06 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 044A8C4167B for ; Thu, 7 Dec 2023 02:16:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442962AbjLGCQ1 (ORCPT ); Wed, 6 Dec 2023 21:16:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbjLGCQZ (ORCPT ); Wed, 6 Dec 2023 21:16:25 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 992E0181 for ; Wed, 6 Dec 2023 18:16:31 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5ddd64f83a4so386907b3.0 for ; Wed, 06 Dec 2023 18:16:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701915391; x=1702520191; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=NsPj5qKC8yO/4S4uTFAVTwLtanN0zO749Ogx8NLNS9w=; b=N/6UkiRk3RlTUolRr2U13HbrMbLP6QBYU30cTKCRXAI4Ocat2gS09LcbqVT6mRgBvB 6lU9Dkd3QOk7YtPtnX192uxmHeBWNSX2QlrfuM+q5eWrgJJtkfvx1a6OAVI6J+dB/kVE Q30a9m5s1cWkhMjQbXyCqv+N+0CDaXB6lGVv65oAKbxZiiPLiT0ELxxTNN7fsSAoA82S 60W2MauRqHl6K996FZNqvwRgkURx8ZzkZkZXymtby186Gi2sMzZUrG/a5Q6Z3sPdla9S IrejgCIeRU4erj7B0z6arqj8BYojnf3h0I/EXaAZRGPQgQoIsPEJT30Qg5Wc8SeTGLt8 nGQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701915391; x=1702520191; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=NsPj5qKC8yO/4S4uTFAVTwLtanN0zO749Ogx8NLNS9w=; b=LE4hv0+2OIAnauY1kn+I9Q7IaUlNOFwKWvWyjHppdK61O5h8GEO1TzLS5gbpTKc2vz Z1UvO9CXMiXqRz0YnUec/AMg50GsCHNDRPcQ2ABQekgzfBTnrWyr2zEeggYOiArPAC07 +kjTrEE3KaTUB5pS61PqEmcptbs/XYce9RIvraMLoJzhGt+MuIp+zNZYjY8ECl+PH57P xbyiT33StU5jEQfeacweHz/yzfd/4izmS+BAhd9RmtVj5y9xPLP3VEiJ7jgSXbdVmO55 GFUsvpBGHoaxGofMbeVtv0dbvDBaRKCzul+w5FnWAezra93sg3+OecuONPzZ3JbZLLWm DrDg== X-Gm-Message-State: AOJu0Yw5eeuPePVfdIrKWZM30kTCcCD4eqMUKlX4f9mapJHaQd8T9b0e CTXrZWGEq1+OEsEBCNiltg+G46MTkqs4 X-Google-Smtp-Source: AGHT+IHKrj0RwlDvYvwye9pD9ZReSUK4nwO3Y2DejPuWpye8TRVrJIGwoeP9TIYKuEtMhjsnlPmt8JxE9oN5 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:35bf:293e:7696:34e9]) (user=irogers job=sendgmr) by 2002:a05:690c:2893:b0:5d3:b449:e58e with SMTP id ee19-20020a05690c289300b005d3b449e58emr26831ywb.6.1701915390873; Wed, 06 Dec 2023 18:16:30 -0800 (PST) Date: Wed, 6 Dec 2023 18:16:27 -0800 Message-Id: <20231207021627.1322884-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Subject: [PATCH v1] perf record: Reduce memory for recording lost samples event From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reduce from PERF_SAMPLE_MAX_SIZE to "sizeof(*lost) + session->machines.host.id_hdr_size". Suggested-by: Namhyung Kim Signed-off-by: Ian Rogers --- Suggested in: https://lore.kernel.org/lkml/CAM9d7cjpYHN_Q63sW70vTCisdW=3D-SzjsrryUUJjgtZ3= +9jdxfA@mail.gmail.com/ --- tools/perf/builtin-record.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index eb5a398ddb1d..206110fc2799 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1954,7 +1954,8 @@ static void record__read_lost_samples(struct record *= rec) =20 if (count.lost) { if (!lost) { - lost =3D zalloc(PERF_SAMPLE_MAX_SIZE); + lost =3D zalloc(sizeof(*lost) + + session->machines.host.id_hdr_size); if (!lost) { pr_debug("Memory allocation failed\n"); return; @@ -1970,7 +1971,8 @@ static void record__read_lost_samples(struct record *= rec) lost_count =3D perf_bpf_filter__lost_count(evsel); if (lost_count) { if (!lost) { - lost =3D zalloc(PERF_SAMPLE_MAX_SIZE); + lost =3D zalloc(sizeof(*lost) + + session->machines.host.id_hdr_size); if (!lost) { pr_debug("Memory allocation failed\n"); return; --=20 2.43.0.rc2.451.g8631bc7472-goog