Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1621385pxp; Thu, 17 Mar 2022 12:55:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNrYVaSEUSsZzhPWBfj7q/X/bgdh3QT2Fq0Hm3csn6Pkazox9PYbc5+Y1ynRmnGyqTt8+h X-Received: by 2002:a17:902:f646:b0:151:d5b1:cbb4 with SMTP id m6-20020a170902f64600b00151d5b1cbb4mr6706971plg.150.1647546958961; Thu, 17 Mar 2022 12:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647546958; cv=none; d=google.com; s=arc-20160816; b=MgEbKuTWijzxUK/E4ibq8+QQvGfdVqQiZJSDHtz7jxxU22dfOr7fspCK+/nRAzksRk I5Egd36Jl2zw4Dr5f1NVZwooi1ft1Ql3Fe0Clz6OgcUIlObjRs4tmSEWxLfsLVCpla3i wxY2oe/J3BTTSuNkjhedVb6WzJjsUuYqE41wEAntu0zNztSmmCvqkKp2N6p3U5SsmdN7 ZNlEHVD1UHCFtNBgkbJRYYlW1qDTuDL8n+BY4OHLYUlbte8FdRrgVuIDkZT06+AHAZgs QeHEeIrDGam1AHtFFlGCMaB2bq8zPCutlRUmu6IWzVopRX/t7Q5TkpfA37S/tal/z6bM tT4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=5AJ+jdGzB5VC3ygMKOoPElKPln3rM1dEMPBCPv/N7+c=; b=p5OG/gGSTAqrTfMqlepuUPEcN39GLGqJtLJGFv0im4hvx/qjiGxlZ5L/wWG3NqoYkn +hgBjqGdGycnjB7+kc8E8xbrb0yItDUL9buKdeuc0C4QaNO27EP1+4a8B2aAyTwyuObc UJl27N1ZTzeurnMjHsGGDpjEkNZxrHGjHsbROp/px+hJK5N68yCHjr//PO4v1yizC7lV +GvRpC5KHbB0nsExYNnSOLw/yh/bGvvpg1XKfDKR5rVtAHmYjxPOwlfJ2Kmb0pMscc/0 uty9kUtETqUJJyzzUV069wGDotb+1cCPz2CJsOsJK4r22nXCoAGMdIxhcgeRk7RNXmMs /P7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=sWuyKjvg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w1-20020a170902d70100b00153b31b1d0bsi4915ply.473.2022.03.17.12.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 12:55:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=sWuyKjvg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72D21264571; Thu, 17 Mar 2022 12:50:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236621AbiCQQo1 (ORCPT + 99 others); Thu, 17 Mar 2022 12:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234572AbiCQQoX (ORCPT ); Thu, 17 Mar 2022 12:44:23 -0400 Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7B5ED0829; Thu, 17 Mar 2022 09:43:06 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 3220E3F12FB; Thu, 17 Mar 2022 12:43:06 -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 WfkQh1S7sllS; Thu, 17 Mar 2022 12:43:05 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 97C833F12FA; Thu, 17 Mar 2022 12:43:05 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 97C833F12FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1647535385; bh=5AJ+jdGzB5VC3ygMKOoPElKPln3rM1dEMPBCPv/N7+c=; h=Date:From:To:Message-ID:MIME-Version; b=sWuyKjvgg62rsf6OstOn1yLtnyrjIRalB4iJ/Atqg8uhCFi4jAKFVCZJGkk+AxnpJ gaR6uuaDn3NAGUyTAy8760ImP8bwRYhpATrNa8cxdUvJ1GKI7zXRjfzgoS9oyMRo2t 6ipXT3irQmEVAhxmFH5wte97QN1xNn+iUDvJKdpCmXp7Wyg/YeR65Gb7EJ9PJu97gw niQzS1dKvo2fOXoq7QQjJWZPUCsSKK7przRnSryQqKtlUHn4seU2/+yJM5I2klj+LF DoJPuyzlwq+tZwDHofEo5NXmGnNeVewqBxoKM06nkLzDgSXg57YpZnm7ugdiJ4uaqZ pM7COTV4OGWSg== 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 vOUprICtB_LA; Thu, 17 Mar 2022 12:43:05 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 81E613F15C0; Thu, 17 Mar 2022 12:43:05 -0400 (EDT) Date: Thu, 17 Mar 2022 12:43:05 -0400 (EDT) From: Mathieu Desnoyers To: rostedt Cc: Namhyung Kim , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , linux-kernel , Thomas Gleixner , Byungchul Park , paulmck , Arnd Bergmann , Radoslaw Burny , linux-arch , bpf Message-ID: <1325267700.157591.1647535385417.JavaMail.zimbra@efficios.com> In-Reply-To: <20220317121055.33812ac1@gandalf.local.home> References: <20220316224548.500123-1-namhyung@kernel.org> <20220316224548.500123-3-namhyung@kernel.org> <365529974.156362.1647524728813.JavaMail.zimbra@efficios.com> <20220317121055.33812ac1@gandalf.local.home> Subject: Re: [PATCH 2/2] locking: Apply contention tracepoints in the slow path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_4203 (ZimbraWebClient - FF98 (Linux)/8.8.15_GA_4232) Thread-Topic: locking: Apply contention tracepoints in the slow path Thread-Index: XtYNwpD1Kl95+SVBT3UlFooWB7QYrg== X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 ----- On Mar 17, 2022, at 12:10 PM, rostedt rostedt@goodmis.org wrote: > On Thu, 17 Mar 2022 09:45:28 -0400 (EDT) > Mathieu Desnoyers wrote: > >> > *sem, bool reader) >> > schedule(); >> > } >> > __set_current_state(TASK_RUNNING); >> > + trace_contention_end(sem, 0); >> >> So for the reader-write locks, and percpu rwlocks, the "trace contention end" >> will always >> have ret=0. Likewise for qspinlock, qrwlock, and rtlock. It seems to be a waste >> of trace >> buffer space to always have space for a return value that is always 0. >> >> Sorry if I missed prior dicussions of that topic, but why introduce this single >> "trace contention begin/end" muxer tracepoint with flags rather than >> per-locking-type >> tracepoint ? The per-locking-type tracepoint could be tuned to only have the >> fields >> that are needed for each locking type. > > per-locking-type tracepoint will also add a bigger footprint. If you are talking about code and data size footprint in the kernel, yes, we agree there. > > One extra byte is not an issue. The implementation uses a 32-bit integer. But given that this only traces contention, it's probably not as important to shrink the event size as if it would be for tracing every uncontended lock/unlock. > This is just the tracepoints. You can still > attach your own specific LTTng trace events that ignores the zero > parameter, and can multiplex into specific types of trace events on your > end. Indeed, I could, as I do for system call entry/exit tracing. But I suspect it would not be worth it for contended locks, because I don't expect those events to be frequent enough in the trace to justify the added code/data footprint, as you pointed out. > > I prefer the current approach as it keeps the tracing footprint down. Likewise. I just wanted to make sure this was done knowing the trace buffer vs kernel code/data overhead trade-off. Thanks, Mathieu > > -- Steve -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com