Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp116309qtg; Thu, 6 Apr 2023 14:10:44 -0700 (PDT) X-Google-Smtp-Source: AKy350YnMFahwilY+TjppPQJFVKcW08+MnTVQscS+2MOwC1kb1ccicLDT8Jmwk9gHNwiOiMWC9u9 X-Received: by 2002:a17:906:b10f:b0:93f:b391:9a07 with SMTP id u15-20020a170906b10f00b0093fb3919a07mr6851613ejy.15.1680815443777; Thu, 06 Apr 2023 14:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680815443; cv=none; d=google.com; s=arc-20160816; b=hXiliX0GGSP7t04gsqU9Va8E1CW8AgZSUrMAH6Iq7zslz71AfH3C0NhqtvrN+gy2mR Rb0FwLENx3aXHd/1Fr6eFeB4Ob6gIf8kc+SUd2aJUBIury9e007QGJuAZ/Ak12Yy71jj j6pFjpmXD1DUaviGZFXerNe50XCjER4/bjfc/SyyGY/C7ecq1EVDhcPEZM7Ld6VQ9NeR Cris5gjeNN1jmuSnKePRvxSSWTgp+pcELOQQmcBs0Wsj3Cqcr//j64/04mdisDOqsicd NoTRyhCowsLWeGA5R8hNBAqEn55W3+NnUgwhL0vs5M1uko2cC/sr56RkZqKTxq0MC8Qg Ol6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=zxgVwiXvPJlNQaBMQo/Fw6ZQAn8/5u3aWEkaLTlJ8CU=; b=GRXAjx/iUEYQDTalyQpViY+gbH3t0oCRjpNXfPS88NKzv2mxhf9Fo+xKB3bij03LHT FsFOVxt0+OQA4wJYezVsjfNjUVc0mTBYDbibzeYX2kl2k5hS8VTuLrAjKk8KqFwBwAYW KpYjwJVrl4W9BeaRWWTqGphhSnlWcprNCAa6/C0iqcgDxdRBK5+pJSyXvT+0o87uTDYh iWF8n+MfsmmNFdw/2Wnhqsy9n7aqtK3IrjG+0Oo7PKpj8FQrZABMQA6SM0ODBGlsFBsQ MVN8k6b+fEWbv2iLJH45dc5uILDVWXNrPORIxdL+ooXd1g4gNVbQGUgfeMnte0Rjnyhq g1eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GPg6on8Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a50fa93000000b004aaa505ac5fsi2054634edr.76.2023.04.06.14.10.19; Thu, 06 Apr 2023 14:10:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GPg6on8Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238029AbjDFVG3 (ORCPT + 99 others); Thu, 6 Apr 2023 17:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237133AbjDFVGT (ORCPT ); Thu, 6 Apr 2023 17:06:19 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABBEC8A51; Thu, 6 Apr 2023 14:06:18 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id p3-20020a17090a74c300b0023f69bc7a68so41851980pjl.4; Thu, 06 Apr 2023 14:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680815178; x=1683407178; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=zxgVwiXvPJlNQaBMQo/Fw6ZQAn8/5u3aWEkaLTlJ8CU=; b=GPg6on8Y7wICuJC6Y8Yy09cCC7BXBxhXNQJKNIBSxkW+EK2MzySsLg9arYaqG4SqYl K4hy2H6oisP/93sUeLh0zv8A8LvhaYXpOBcznkiv506kVZIAIEv9ggrmztaBRGCVekdW 2C4EkJgp7WaX5E1dI4lQaxdmNlmPoOQnXLT+PlgNHMaIf+J2bu5NvTwtV4Sqe1GnunrK jzgOKCZyC6/ols+Kwi3Z8pCrs8zHrKqxctEHGXS+E5zzSb8RSB7CgUrmZ5+eG2evHQFm o6Q/15MlUptNRyjVczPF7r9EKq4YqdSCSpYJgeBSq71CDxCeP14XtzXaNO1m5HlJIrN/ lzbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680815178; x=1683407178; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zxgVwiXvPJlNQaBMQo/Fw6ZQAn8/5u3aWEkaLTlJ8CU=; b=EP5feL0ib6QEp6PQBV++/6Za9+ov7yA84VaCvJ9TtIGmd7nLN3k3q48u1Cfi1gGaaJ 4IAx81O5C1oK0lGGaMUq83opNg1TO9p/rxZVS22JVNI5nAzUh0mb6zfC+rbUFgZj1UOn BNhG4fLXdOVDCe3Wlb9qPqsqNCUSUzI8+1erQMiqQ5L6BU/rFYSUV9BgJ9RRDJ0dInZl CeXpR8t0gUPdimUpCHoWZ1JzDxJ8X2wGWn8UZGmioQkK5R/VqNG38ZnEa6ulSnWZi6cX 8SYcMg7OErtPt836oSGOhsH0qQc7miqXz4rk2lCazUEVjBusW69+OPVYwG2/BRyyfG6e +8lw== X-Gm-Message-State: AAQBX9feH1DT8XC2oqxI1i8I+GZgD1Gv2QZxWEYKbeXCqv7SKDaWNy9R mL5Ukn5/9VnQSXm6ebml9rc= X-Received: by 2002:a17:902:ce88:b0:19e:2fb0:a5d9 with SMTP id f8-20020a170902ce8800b0019e2fb0a5d9mr7367025plg.32.1680815177855; Thu, 06 Apr 2023 14:06:17 -0700 (PDT) Received: from moohyul.svl.corp.google.com ([2620:15c:2d4:203:3301:38fe:e39e:3d51]) by smtp.gmail.com with ESMTPSA id g5-20020a170902868500b001a0667822c8sm1777837plo.94.2023.04.06.14.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 14:06:17 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Song Liu , Hao Luo , bpf@vger.kernel.org, Juri Lelli Subject: [PATCH 3/7] perf lock contention: Update default map size to 16384 Date: Thu, 6 Apr 2023 14:06:07 -0700 Message-Id: <20230406210611.1622492-4-namhyung@kernel.org> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog In-Reply-To: <20230406210611.1622492-1-namhyung@kernel.org> References: <20230406210611.1622492-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The BPF hash map will align the map size to a power of 2. So 10k would be 16k anyway. Let's have the actual size to avoid confusions. Signed-off-by: Namhyung Kim --- tools/perf/Documentation/perf-lock.txt | 3 ++- tools/perf/builtin-lock.c | 2 +- tools/perf/util/bpf_skel/lock_contention.bpf.c | 5 +---- tools/perf/util/bpf_skel/lock_data.h | 3 +++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/perf/Documentation/perf-lock.txt b/tools/perf/Documentation/perf-lock.txt index b5e5d088d51c..6e5ba3cd2b72 100644 --- a/tools/perf/Documentation/perf-lock.txt +++ b/tools/perf/Documentation/perf-lock.txt @@ -157,7 +157,8 @@ CONTENTION OPTIONS -M:: --map-nr-entries=:: - Maximum number of BPF map entries (default: 10240). + Maximum number of BPF map entries (default: 16384). + This will be aligned to a power of 2. --max-stack=:: Maximum stack depth when collecting lock contention (default: 8). diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index ef56bf90058d..9b92c7a5aefb 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -60,7 +60,7 @@ static bool show_thread_stats; static bool show_lock_addrs; static bool show_lock_owner; static bool use_bpf; -static unsigned long bpf_map_entries = 10240; +static unsigned long bpf_map_entries = MAX_ENTRIES; static int max_stack_depth = CONTENTION_STACK_DEPTH; static int stack_skip = CONTENTION_STACK_SKIP; static int print_nr_entries = INT_MAX / 2; diff --git a/tools/perf/util/bpf_skel/lock_contention.bpf.c b/tools/perf/util/bpf_skel/lock_contention.bpf.c index 3f4ee3992e81..f9d2d792ccc8 100644 --- a/tools/perf/util/bpf_skel/lock_contention.bpf.c +++ b/tools/perf/util/bpf_skel/lock_contention.bpf.c @@ -7,9 +7,6 @@ #include "lock_data.h" -/* default buffer size */ -#define MAX_ENTRIES 10240 - /* for collect_lock_syms(). 4096 was rejected by the verifier */ #define MAX_CPUS 1024 @@ -63,7 +60,7 @@ struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(key_size, sizeof(__u64)); __uint(value_size, sizeof(__u32)); - __uint(max_entries, 16384); + __uint(max_entries, MAX_ENTRIES); } lock_syms SEC(".maps"); struct { diff --git a/tools/perf/util/bpf_skel/lock_data.h b/tools/perf/util/bpf_skel/lock_data.h index 1ba61cb4d480..260062a9f2ab 100644 --- a/tools/perf/util/bpf_skel/lock_data.h +++ b/tools/perf/util/bpf_skel/lock_data.h @@ -15,6 +15,9 @@ struct contention_task_data { char comm[TASK_COMM_LEN]; }; +/* default buffer size */ +#define MAX_ENTRIES 16384 + /* * Upper bits of the flags in the contention_data are used to identify * some well-known locks which do not have symbols (non-global locks). -- 2.40.0.577.gac1e443424-goog