Message ID | 20231207021627.1322884-1-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4508488vqy; Wed, 6 Dec 2023 18:16:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzgY+oVcgacmdadZ2tIuMl8IHjz1afJcNJKnuUF3gkp7yLapxmIeRpX9uVEVgOoTMtKoOK X-Received: by 2002:a17:90b:3a8e:b0:286:3d7e:5e7f with SMTP id om14-20020a17090b3a8e00b002863d7e5e7fmr1566928pjb.18.1701915404392; Wed, 06 Dec 2023 18:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701915404; cv=none; d=google.com; s=arc-20160816; b=0tvYCtQitcY75hjuYF5WXk9STOGc3BPtH0KTklRUeyo4ILDxDu+6TJtRfNH9v4j3Dz reL27l/cwKdhBjIlXgl1/uaiuCv0D0mTd3d/YDWG/BtoRucNBi7B7GHRxrIbO/vzc07W +HSfoixQzKLz5GzPxoY+nu81/ub0StTin/jfQhlrhqH7wrTCfBdgVR+Jz6jJaC294q6+ ILdldBM+1jwUsLjZ/DBcOqHHUwK4tz6c8pQWRHIeAQVjxS/fGapz0ArMhyZzNLIKeGKh FS8yfWqaVUAkZNxCeoRbZjJiWvFGxsjZf1B6Ksjhfxr2hGYji5sXz6ylAL3IJGbhuCmx 3Low== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:mime-version:message-id:date :dkim-signature; bh=NsPj5qKC8yO/4S4uTFAVTwLtanN0zO749Ogx8NLNS9w=; fh=M03QQq2BGgAHjQvEE5ebB9F7AIwQdsROrtXDdf41UXo=; b=c51nYnGgTI8SQNvj1TiSpw1mngoFeiCphJTny+6zyfBJee/+YWEPuZDoWbDhLh6GY9 xn6C54/pqqf2SF+5ObCdCApj7SV2Vy8fOBhbvNVAb61g2wwa09rvYCoxhCiB9Z4UqqUC el6rFyVjztqq8mGSNHZenUi+x6gvM/o3lXS8CRmAMPovWbGMZrhKA21bWO/zcs+F+moC EgEnNDeFM4ct6IKj87xkY/s0zIQ91FbDu9VxZIGmK3X6K1ewjSdF5Ouq69hG5fbgSkdM l0akspiiJ3P3xS3s61CN5QbwkTPQ/yhWw1WyRwLNYGqwiJ7Wx1xJMsl+M5N2WXENX6vP XTzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="N/6UkiRk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ci9-20020a17090afc8900b002866fa27195si170727pjb.42.2023.12.06.18.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 18:16:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="N/6UkiRk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A8BF78411891; Wed, 6 Dec 2023 18:16:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235150AbjLGCQ0 (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Wed, 6 Dec 2023 21:16:26 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; Wed, 6 Dec 2023 18:16:31 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5ddd64f83a4so386907b3.0 for <linux-kernel@vger.kernel.org>; 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-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 <irogers@google.com> To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 18:16:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784587647360612048 X-GMAIL-MSGID: 1784587647360612048 |
Series |
[v1] perf record: Reduce memory for recording lost samples event
|
|
Commit Message
Ian Rogers
Dec. 7, 2023, 2:16 a.m. UTC
Reduce from PERF_SAMPLE_MAX_SIZE to "sizeof(*lost) +
session->machines.host.id_hdr_size".
Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
---
Suggested in:
https://lore.kernel.org/lkml/CAM9d7cjpYHN_Q63sW70vTCisdW=-SzjsrryUUJjgtZ3+9jdxfA@mail.gmail.com/
---
tools/perf/builtin-record.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Comments
On Wed, Dec 6, 2023 at 6:16 PM Ian Rogers <irogers@google.com> wrote: > > Reduce from PERF_SAMPLE_MAX_SIZE to "sizeof(*lost) + > session->machines.host.id_hdr_size". > > Suggested-by: Namhyung Kim <namhyung@kernel.org> > Signed-off-by: Ian Rogers <irogers@google.com> Ping. Thanks, Ian > --- > Suggested in: > https://lore.kernel.org/lkml/CAM9d7cjpYHN_Q63sW70vTCisdW=-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) > > if (count.lost) { > if (!lost) { > - lost = zalloc(PERF_SAMPLE_MAX_SIZE); > + lost = 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 = perf_bpf_filter__lost_count(evsel); > if (lost_count) { > if (!lost) { > - lost = zalloc(PERF_SAMPLE_MAX_SIZE); > + lost = zalloc(sizeof(*lost) + > + session->machines.host.id_hdr_size); > if (!lost) { > pr_debug("Memory allocation failed\n"); > return; > -- > 2.43.0.rc2.451.g8631bc7472-goog >
Em Wed, Dec 06, 2023 at 06:16:27PM -0800, Ian Rogers escreveu: > Reduce from PERF_SAMPLE_MAX_SIZE to "sizeof(*lost) + > session->machines.host.id_hdr_size". > > Suggested-by: Namhyung Kim <namhyung@kernel.org> Thanks, applied to perf-tools-next. - Arnaldo > Signed-off-by: Ian Rogers <irogers@google.com> > --- > Suggested in: > https://lore.kernel.org/lkml/CAM9d7cjpYHN_Q63sW70vTCisdW=-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) > > if (count.lost) { > if (!lost) { > - lost = zalloc(PERF_SAMPLE_MAX_SIZE); > + lost = 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 = perf_bpf_filter__lost_count(evsel); > if (lost_count) { > if (!lost) { > - lost = zalloc(PERF_SAMPLE_MAX_SIZE); > + lost = zalloc(sizeof(*lost) + > + session->machines.host.id_hdr_size); > if (!lost) { > pr_debug("Memory allocation failed\n"); > return; > -- > 2.43.0.rc2.451.g8631bc7472-goog >
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) if (count.lost) { if (!lost) { - lost = zalloc(PERF_SAMPLE_MAX_SIZE); + lost = 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 = perf_bpf_filter__lost_count(evsel); if (lost_count) { if (!lost) { - lost = zalloc(PERF_SAMPLE_MAX_SIZE); + lost = zalloc(sizeof(*lost) + + session->machines.host.id_hdr_size); if (!lost) { pr_debug("Memory allocation failed\n"); return;