Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp491575lqb; Wed, 29 May 2024 01:36:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVPrfc42UIZx1nOcZHLCNkUrspQ+EUz68DEj5C0qjhrMCj6kpQLm+wXYoa0YW98GFfOSiYnw7CAqZhbUQnp1tL44hH6EoTcf+z/Yz+8oQ== X-Google-Smtp-Source: AGHT+IE69gOyoGLbd/3gFH/Hm2ugsfdWpVL1oPdwMDmvIYvUpo5xaR4fntWjFDXb/86nDEicw2nG X-Received: by 2002:a17:906:2dcd:b0:a59:9a68:7283 with SMTP id a640c23a62f3a-a62641a572dmr778470966b.12.1716971801016; Wed, 29 May 2024 01:36:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716971800; cv=pass; d=google.com; s=arc-20160816; b=mSEftFC0Pn1jLS7H957hE2QIhk/w4v0syAUUMNCC7S6UPVN1ZmK2s1GRrvSKjoaHiT kd7odoKopadjmGWa7yCqZHQQ/p6SE3SB8PALTjSGo1rNaOxeOOLc3909X13cnCfySAt5 acr7WTg2Wrt5XgR0FMPDf8N0ig50Scz4+evDvxm09T8cEQ30acxTIHiTQ32dQxkpIb3X XyjdwdeXe1M2i1li2IDLXo21rF4CdX68bahx/oZJj4dQGcHgqyScyUzGLkpMG57MKMVn LKS1D9zFuF6B+N+HkMtB+meW51+DXUGpILCXPU0nMGuOzdCrgLOjulKTeGz13dbr6BrJ VL9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from:dkim-signature; bh=rn7yPS61VZDyN0hXW0NrmYKzmNUSInF0ZrwB9evZ1F8=; fh=x/3SgjNS8jUpPhk1QsoVQjuk8KZxQxZIXyJfn+73vn0=; b=N+cRwiCG6M+r4NMnjgyF8uANpc2tgaOWrSVkxGqT04N7qKI0YA1yykffGsEc1tZXb+ iloNstzfG7uaiebzZtueNGgQP1wWetTS+vx6EvSJqzfGpU4bn3tMqXTRQEnGxdZD0J0K QJAwnua15a+hoaBYhNaOdGKvT1E/QkXI2sF4YNx2+wKt99lWwBCr2b4bRsdwklCn5cfn u35DsgWmtSBuElToKI5tA5CuzBxP6GVUW1v07p1ndKUQdWFUvcybt8wSKRI238iV3ux3 wyHFodEfZ9fO9xwGLdgp2senxjZOFZ7DixQnnaSLQqOxPrSOb/Vxfe33CAcx0N58puEq JkvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eSlKwQV6; 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-193754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a63574a2773si116783066b.180.2024.05.29.01.36.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 01:36:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eSlKwQV6; 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-193754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193754-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 B9BD71F22793 for ; Wed, 29 May 2024 08:36:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AC1D16C6A0; Wed, 29 May 2024 08:31:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eSlKwQV6" Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 EF3CE16A380; Wed, 29 May 2024 08:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716971490; cv=none; b=Mleta4djfW7Y57eolemQY6XXeAfwmU7USDHmqEEvSgBmT4Ofe8hOyHwjejvwhrfOlJLyvhBzs4NG233ueh1V2OY4wL9AziIqJdNiPRTB2r5Nuejo6TMvzxgRS1X3BtrBNjGyEh7OdM1H5LRU2oE/i5bVDDJm9dvEhzZ3oX62DRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716971490; c=relaxed/simple; bh=g8wLVx6SzI7f5hfBWjCx8/IiFtnpI5IJH84ulc3VsEM=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=i9efdMUX5247T9Ry709p23zO0JelV/jtT5L5wiP9eE5KM6MfoK9sEbh/9t0X8k6Qce1/gIB7GNq4ZHLV3j6f/b1wfToAvq+nltltveq1eOQ56jdXBNgWIIKOhVKCp2wxSPTkz+U7OwZtfEVrCyXZJv0fLOJRdWoxD8z8YY4o4tM= 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=eSlKwQV6; arc=none smtp.client-ip=209.85.128.44 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-wm1-f44.google.com with SMTP id 5b1f17b1804b1-42101a2ac2cso15301675e9.0; Wed, 29 May 2024 01:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716971487; x=1717576287; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=rn7yPS61VZDyN0hXW0NrmYKzmNUSInF0ZrwB9evZ1F8=; b=eSlKwQV65+3CTLQvtQrK4CTKupGaewTEFgzelyuGJx2eT2E93IlP6IMcNqPy4sYU2u 7O8DFaPj5YoWwQrL2Lk+rHTTkzeCIR1o5iPQcRRI9LLVbPPBMWIkjvhlAttlUiWddqXc EXQkIHIXKP6+K/lBfSizSPyJKZ4HYB+T0Cg9rY0kh/CItemTiHWICxxIY+aODcjFBdvj 3TXqAuMJvP+90SNN7x7xKfctY9nPxrbcCJeZVwK1YyS0xkEZMaODEO/ufLvUsfRJd3dJ hv8fkuO/3msPnLoP7Mhmvwl9l6zJht84i3QS+zn0GUNJ1L4XjRPbzdHNh79QGzhcsAhl +IGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716971487; x=1717576287; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rn7yPS61VZDyN0hXW0NrmYKzmNUSInF0ZrwB9evZ1F8=; b=u76IGlEtY7brFr7aMwLI1rF7NPWdXFfc1GaEzEedJ4L7li9NtWoGzB2GJO/WAW4+t9 V4E8kwf5X6XmlezL9pcTWza5nSBvUtgl9ZOn9otryNedlm8JbOmR9gdBl2+QNuI1FS9d vP82guQWpEzQCJN8LQQqizBslaBr+1MBj0RD5rK0qtWZV+e8yBZB8MWelCFDHBf/Ncol yXma7yuY8IXBPMpGvrboG6a+vfwaF2pyW635IxkFB2L9QJirvrf0xKBWvBCFKDLGuONU bpQ5nfQ4FvKLMhwExBR1iHxyRiDsHAZJoVJFsjqHAFOCIqiihG4vSph3nVD86e74pvIc tJ+g== X-Forwarded-Encrypted: i=1; AJvYcCW1BpSWuw6eO90jppbWx6/JAzJNZMO1TB7qMWhjCTGiXCoBzKJ0LNZ8P5oA76gDJG4pVf5mzcrQ3NxphMYrqgRgzwfTSTn3xnLg4145j4KyV09LL2TFNnPmBESOeG2hYY9r X-Gm-Message-State: AOJu0YxLUsk9oDJJ8Z8AovKTuopx3MjBTsQUGtJXPQKWCYCQkNz73bRd 0IuY9AieWRHSG2vDyE3y2wxY2AvUmRIMJbeS25spQY0fxLCFu2to X-Received: by 2002:adf:e444:0:b0:356:4cfa:b4b9 with SMTP id ffacd0b85a97d-3564cfaecfdmr8805125f8f.2.1716971486900; Wed, 29 May 2024 01:31:26 -0700 (PDT) Received: from krava (2001-1ae9-1c2-4c00-726e-c10f-8833-ff22.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:726e:c10f:8833:ff22]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-358a33e6f03sm9046320f8f.36.2024.05.29.01.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 01:31:26 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Wed, 29 May 2024 10:31:24 +0200 To: Namhyung Kim Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , LKML , bpf@vger.kernel.org, Aleksei Shchekotikhin , Nilay Vaish Subject: Re: [PATCH v2] bpf: Allocate bpf_event_entry with node info Message-ID: References: <20240529065311.1218230-1-namhyung@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240529065311.1218230-1-namhyung@kernel.org> On Tue, May 28, 2024 at 11:53:11PM -0700, Namhyung Kim wrote: > It was reported that accessing perf_event map entry caused pretty high > LLC misses in get_map_perf_counter(). As reading perf_event is allowed > for the local CPU only, I think we can use the target CPU of the event > as hint for the allocation like in perf_event_alloc() so that the event > and the entry can be in the same node at least. looks good, is there any profile to prove the gain? jirka > > Reported-by: Aleksei Shchekotikhin > Reported-by: Nilay Vaish > Signed-off-by: Namhyung Kim > --- > v2) fix build errors > > kernel/bpf/arraymap.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c > index feabc0193852..067f7cf27042 100644 > --- a/kernel/bpf/arraymap.c > +++ b/kernel/bpf/arraymap.c > @@ -1194,10 +1194,17 @@ static struct bpf_event_entry *bpf_event_entry_gen(struct file *perf_file, > struct file *map_file) > { > struct bpf_event_entry *ee; > + struct perf_event *event = perf_file->private_data; > + int node = -1; > > - ee = kzalloc(sizeof(*ee), GFP_KERNEL); > +#ifdef CONFIG_PERF_EVENTS > + if (event->cpu >= 0) > + node = cpu_to_node(event->cpu); > +#endif > + > + ee = kzalloc_node(sizeof(*ee), GFP_KERNEL, node); > if (ee) { > - ee->event = perf_file->private_data; > + ee->event = event; > ee->perf_file = perf_file; > ee->map_file = map_file; > } > -- > 2.45.1.288.g0e0cd299f1-goog >