From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NkuzGg5q2GJyVBcAWB0awg (envelope-from ) for ; Wed, 20 Jul 2022 16:48:14 -0400 Received: by simark.ca (Postfix, from userid 112) id 5A2AF1E5EA; Wed, 20 Jul 2022 16:48:14 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=lists.lttng.org header.i=@lists.lttng.org header.a=rsa-sha256 header.s=default header.b=Y18KIBE3; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E912A1E21F for ; Wed, 20 Jul 2022 16:48:13 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1658350093; bh=559sJ8SMFpuqzW3Yfwj79GaCpgNU14BUBLeylpPm5gw=; h=Date:To:Cc:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Y18KIBE3n6fthUzho94xcrxPCO9piGFlQet/dupOJPF08NT+9zqsAnRf3r+Ni62e8 P2X9qt1r9/Mk1+Vj9iADz/VXIF6aJUF5lJj9EY02YnRvMjcGzkrKAGVe5z5wRcI/HM vSJ4NRc2+QnYHrYIC0mCFvSBlWaWOFZZRHIHF7x6COjkxvcWxXTjrEYpM65qA5BkYP QT/APO5EGRB2+2JENlKGSvq/7WlzXM2Hi0wxe/n9bXMNXRzCf6ZeSf4S7vjmRObJMG X15YXu5jlIGJjO/rvaiYU0yYVoZskRnNvDhItcj7wLIoRhRM0KjURZy+HzkLRNUdB9 15OAmhYb9cP8Q== Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4Lp77x222tzQ6x; Wed, 20 Jul 2022 16:48:13 -0400 (EDT) Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by lists.lttng.org (Postfix) with ESMTPS id 4Lp77w117czQ9L for ; Wed, 20 Jul 2022 16:48:11 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 20D593ABD34 for ; Wed, 20 Jul 2022 16:48:05 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id U4KKFTox2txy; Wed, 20 Jul 2022 16:48:04 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id A687B3ABD15; Wed, 20 Jul 2022 16:48:04 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com A687B3ABD15 X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id PCvMHC8SQ3ha; Wed, 20 Jul 2022 16:48:04 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 98B9E3ABC74; Wed, 20 Jul 2022 16:48:04 -0400 (EDT) Date: Wed, 20 Jul 2022 16:48:04 -0400 (EDT) To: Norbert Lange Cc: lttng-dev Message-ID: <1505688139.75465.1658350084533.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20220718215955.124991-1-nolange79@gmail.com> <1399876011.74159.1658259573115.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_4304 (ZimbraWebClient - FF100 (Linux)/8.8.15_GA_4304) Thread-Topic: lttng_ust_init_thread: initialise cached context values Thread-Index: xJcUs2dBqXIj6K4InYwHbw5Kff6HOA== Subject: Re: [lttng-dev] [PATCH 1/2] lttng_ust_init_thread: initialise cached context values X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mathieu Desnoyers via lttng-dev Reply-To: Mathieu Desnoyers Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" ----- On Jul 20, 2022, at 4:00 PM, Norbert Lange nolange79@gmail.com wrote: > Am Di., 19. Juli 2022 um 21:39 Uhr schrieb Mathieu Desnoyers > : >> >> ----- On Jul 18, 2022, at 5:59 PM, Norbert Lange via lttng-dev >> lttng-dev@lists.lttng.org wrote: >> >> > Modify all relevant *_alloc_tls functions so that they take an >> > argument for 'init'. Setting this to 'true' will read >> > the actual context value and store it into a thread local >> > cache. >> > >> > The function 'lttng_ust_init_thread' will use this to >> > precalculate context values. Tracepoints can then avoid >> > systemcalls. >> >> Rather than integrating two unrelated things within "alloc_tls" >> functions, I would prefer that we split things like this, e.g.: >> >> keep lttng_cgroup_ns_alloc_tls() as is. >> >> Introduce lttng_ust_cgroup_init_thread() which would >> call (void)get_cgroup_ns(). >> >> Likewise for all other contexts. >> >> Thoughts ? > > is this just a matter of the function name? The "things" are > related as they both prepare the same thread local cache. > > ie. > rename lttng_cgroup_ns_alloc_tls(bool init) to > lttng_ust_cgroup_init_thread(bool initcache)? > > Don't care much either way,I just usually try to limit symbols. So AFAIU when only alloc_tls is needed, you would just change that for lttng_ust_cgroup_init_thread(false), correct ? I would then prefer that we introduce flags rather than rely on a boolean to make it immediately clear what is done from the callsite, e.g.: enum lttng_ust_init_thread_flags { LTTNG_UST_INIT_THREAD_TLS = (1 << 0), LTTNG_UST_INIT_THREAD_CONTEXT_CACHE = (1 << 1), } lttng_ust_cgroup_init_thread(int init_thread_flags) And then call either: lttng_ust_cgroup_init_thread(LTTNG_UST_INIT_THREAD_TLS) to initialize the tls. lttng_ust_cgroup_init_thread(LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) to initialize the thread context cache. or lttng_ust_cgroup_init_thread(LTTNG_UST_INIT_THREAD_TLS | LTTNG_UST_INIT_THREAD_CONTEXT_CACHE) to initialize both. Thoughts ? Thanks, Mathieu > > Regards, > Norbert -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev