Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp107546ybg; Tue, 22 Oct 2019 17:01:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+PhNVOJkm0WLCydrPfn7r3ZCtbd0yo7j7ovdzxCrXiJwLzckE8jiiUmDEz1mi3hFhJirx X-Received: by 2002:a50:af22:: with SMTP id g31mr34161956edd.199.1571788895852; Tue, 22 Oct 2019 17:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571788895; cv=none; d=google.com; s=arc-20160816; b=ufIugkmwBadVT8zz86CDsz3sglTgX5+DFaFWkVtDL+wia+wpOV0Gk1CJ+A30JhTwEA nlhM/VlTPtvNQuyQ8RyflzaL1cv3ZuP7ke9ZFo+TloV4gP2ABBLxklrsQS+qdpZzB+/N N1hHPdysMNcfFNn6tfYBMRGaEGz+NDRh0dUdsJn6pXYdHII+/9QpGWEgqIMRoBdbfBHo E8m0Gs0T3xqN1vmOjTfcu5oDm6NSCn40lDCz3qMaH550gUyzZmHSaSIfWIGXPUA7Gtqq Pr4n6rK+689c21/vNgrbnJ8WImjr3GSRKTZIUnWg2Uq7S6l05eoJ3m90tioED2AK/KrX sWpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=UYAXkRAU4xOvfR1xuzJC4z6kmr3YYKY8rIW7KcKh/Pg=; b=lGodHU2PRgqfdhk3lxcSUZuMXA1vF4Gk5De5Yhm7JEfXt+9Wv342F/GW5tbCjfHxXn cjS+92P2M6zdV1IXwFtj8AlmeZqYcHuBxtjgH0APTf5NikpgaKjBUnR9irXYRHWCUsBx n4wEoaLF4XkEQ5pmIhs+DAP0kQBqoLesImAom/b4YZE5XSrRhxL1KMatfzPZPDKaPCq4 cIL6Cr1pKx9IESzPwVCP+IiRT47Vbjy6UR2PXp7UOYsQj0i0zbWZY03oM2TNDDTgXMSf ewLLJebG9w6WURx/xF64jGDFufFohS/ndLu/k2/0asHywSRCWGue3A4FgUvlMlbGEsyd /w9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si14895652edk.157.2019.10.22.17.01.10; Tue, 22 Oct 2019 17:01:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733187AbfJVVpy (ORCPT + 99 others); Tue, 22 Oct 2019 17:45:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:39534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733177AbfJVVpy (ORCPT ); Tue, 22 Oct 2019 17:45:54 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2938D2084B; Tue, 22 Oct 2019 21:45:53 +0000 (UTC) Date: Tue, 22 Oct 2019 17:45:51 -0400 From: Steven Rostedt To: Hassan Naveed Cc: Ingo Molnar , "linux-kernel@vger.kernel.org" , Paul Burton Subject: Re: [PATCH] TRACING: FTRACE: Use xarray structure for ftrace syscalls Message-ID: <20191022174551.2fcc85fd@gandalf.local.home> In-Reply-To: <20191022155104.29b062a5@gandalf.local.home> References: <20191022182303.14829-1-hnaveed@wavecomp.com> <20191022155104.29b062a5@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 Oct 2019 15:51:04 -0400 Steven Rostedt wrote: > > static struct syscall_metadata *syscall_nr_to_meta(int nr) > > { > > - if (!syscalls_metadata || nr >= NR_syscalls || nr < 0) > > - return NULL; > > - > > - return syscalls_metadata[nr]; > > + return xa_load(&syscalls_metadata, (unsigned long)nr); > > } > > There appears to be a slight overhead to this for archs that do not have a sparse syscall array. I wonder if we should make this only applicable for archs (via adding a HAVE_SPARSE_SYSCALL_NR define and checking against it). Then if an arch doesn't have a sparse array of system calls, it uses a normal lookup, but for archs that do, it can define this for this type of lookup. There's not much to this patch, so it wouldn't be too difficult to support both methods. Without this patch I ran: # trace-cmd start -e syscalls # /work/c/hackbench 50 Time: 15.702 # /work/c/hackbench 50 Time: 15.932 # /work/c/hackbench 50 Time: 15.893 # /work/c/hackbench 50 Time: 16.038 # /work/c/hackbench 50 Time: 15.429 With the patch it had: # trace-cmd start -e syscalls # /work/c/hackbench 50 Time: 16.582 # /work/c/hackbench 50 Time: 15.972 # /work/c/hackbench 50 Time: 16.078 # /work/c/hackbench 50 Time: 16.133 # /work/c/hackbench 50 Time: 16.263 -- Steve