Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4213507rwe; Mon, 17 Apr 2023 09:23:43 -0700 (PDT) X-Google-Smtp-Source: AKy350Zjo+bmeVVjTldW78DltEf5stfYLAIR6Xv7GhB0OaVJtER0I7oHQdy0Sluv9joqlqkbhY4u X-Received: by 2002:a17:90b:3a82:b0:246:8497:37c5 with SMTP id om2-20020a17090b3a8200b00246849737c5mr15150160pjb.46.1681748623116; Mon, 17 Apr 2023 09:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681748623; cv=none; d=google.com; s=arc-20160816; b=RTbqaHLGPl0zsB19qbgvNLn5qlu+wQ82SFO2tcPHV/1fv7Qi6tKVKzNySlF+xtcXhe c0TyvOUE430YKftzI5C/Y9z8fH+y9L8tcT3M750kMd1YMA9ipHFHFYVvi61lwiYRwnMN 8jGI60vA4TKXGqa6ojYjy7ENhMal0TGVGiiKjlSLRkqrWBszK6RAynnRyTqyJY0bd23g 9/cQz4gwsr4bPuBjKdtIIQQx4s6Fxe/l4Ul1dZBVv2xGAuU02J+oAMbPVxGAk6ISb+mq Zd3siHCWwrfWjQ5HTbawMLgcJMMGCwsAkLREByx/w26VQl4RQx8ae8xtVrpv0p39r+BE f6Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9qqF9B0Sz3hWGl8lp8w0SC9VFttXX9F/0UBZXJc8LdE=; b=Rg4NoaXE8SDrAFwVNc2mUUeLt8/1M7SQilhUMXuONcal2y0S0lTNxswPAGViwwZaMv KjxjQAuk/HeiHvUQAWLpIubzYWbTjdthUAw2ow6+ZyuWEbqrG/AfkbIMqPkG3gKfTGBF AyWEGEIEJR87WLhdXCUHcTwAoqxAHmX39mEY3A4IqMZyzfhZPL9V5QvSDM3eLXQE/V1K RcMy9Q3ClBkub0v6BIyKheVfUJLh/Qf/Vov69AtEGWwf8sxce90U3h/B2Gf6bsRf33Vi Ux9JOxPNKvym/my9OWkSPn3wGmgKc6tuYWQFgxF6MVso2Wywg32GQYmGpd2oG2DqWck/ dhTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=O+IupxaO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d35-20020a630e23000000b0051b2f6c48ffsi11305862pgl.793.2023.04.17.09.23.29; Mon, 17 Apr 2023 09:23: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=@google.com header.s=20221208 header.b=O+IupxaO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229976AbjDQQWl (ORCPT + 99 others); Mon, 17 Apr 2023 12:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230384AbjDQQWb (ORCPT ); Mon, 17 Apr 2023 12:22:31 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69BFB2D64 for ; Mon, 17 Apr 2023 09:22:26 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-54f21cdfadbso372598837b3.7 for ; Mon, 17 Apr 2023 09:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681748545; x=1684340545; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9qqF9B0Sz3hWGl8lp8w0SC9VFttXX9F/0UBZXJc8LdE=; b=O+IupxaO3kOEk4LZ8PMz7M1+WC06Ctx7jwcKQOXom5VE2vP548mPHKM62zpIsbZ/z5 J/bUAgd38QG9yjfv6lFEa92MzyY5mDDeU7qY2XEAmv4WHIL3o6ZQStKvK53ZyqXTG1Ux raay+P0IBseG5ELTRQWxxGHsUEAm8/y33N2BM/dO9nsU/IqsdEz5SqKAG9AVQWakzb/i i6A1Nc9BlTL4Gmce2wcpjpusihjc7uyl+Gq2O5LVk22cDjm9olATWEg+V1qRiTDvYZK8 u1sazrm+KAwfJf8RESywW7ocFI80bOLzXHGcfH2NghpmkfBzt9mlx5uiX2jGnjxLMUke EZrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681748545; x=1684340545; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9qqF9B0Sz3hWGl8lp8w0SC9VFttXX9F/0UBZXJc8LdE=; b=frEhkuhwQ+AyPaS/j7oXJtUgLF/CtwIPeUQNoibuWHqINQ0oPIR/enf9y6MGrAYdJs OxYyxsVgl0Rvyy3+ILS/CPZfkRpFRiK96C6s/+RNMwANJl9gefLkdD4/Xl4LJYMnCC4M DhQ8IcTEIyJ19N8spWaaS/fjh4PvVCHO+IqWsPXBtnDvcdmxz8b89yNXiLZBVgp95JuE Mtub8wd3Ys5MbWZaN2KR1J9QdvJ1H4HQqZ2NtOqylp2RmnJnTijwXUGFuSHYrxp4RKYd T5b4uaUuyxhEiF/Q1u/dK1RNkEXcWWj9cwJCAON0gSk61Ej0HhPm/0/vhv9Y1kQCJ3V7 T5Jw== X-Gm-Message-State: AAQBX9ddM/RC45YveWEFa6K1WoKmNenLBZyTXk2gRWe7yS4zvom9R+Nb g2Gfokn6U6Ey5wG7zD7x8E2Vd8QOVyTcCbEX/CTO X-Received: by 2002:a81:b50a:0:b0:54b:fd28:c5ff with SMTP id t10-20020a81b50a000000b0054bfd28c5ffmr9878142ywh.3.1681748545541; Mon, 17 Apr 2023 09:22:25 -0700 (PDT) MIME-Version: 1.0 References: <20230412023839.2869114-1-jstultz@google.com> <20230412035905.3184199-1-jstultz@google.com> <20230417111949.GJ83892@hirez.programming.kicks-ass.net> In-Reply-To: <20230417111949.GJ83892@hirez.programming.kicks-ass.net> From: John Stultz Date: Mon, 17 Apr 2023 18:22:14 +0200 Message-ID: Subject: Re: [PATCH v2] locking/rwsem: Add __always_inline annotation to __down_read_common() To: Peter Zijlstra Cc: LKML , Minchan Kim , Tim Murray , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , kernel-team@android.com, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 Mon, Apr 17, 2023 at 1:19=E2=80=AFPM Peter Zijlstra wrote: > > On Wed, Apr 12, 2023 at 03:59:05AM +0000, John Stultz wrote: > > Apparently despite it being marked inline, the compiler > > may not inline __down_read_common() which makes it difficult > > to identify the cause of lock contention, as the blocked > > function will always be listed as __down_read_common(). > > > > So this patch adds __always_inline annotation to the > > function to force it to be inlines so the calling function > > will be listed. > > I'm a wee bit confused; what are you looking at? Wchan? Apologies! Yes, traceevent data via wchan, sorry I didn't make that clear. > What is stopping > the compiler from now handing you > __down_read{,_interruptible,_killable}() instead? Is that fine? No, we want to make the blocked calling function, rather than the locking functions, visible in the tracepoints captured. That said, the other __down_read* functions seem to be properly inlined in practice (Waiman's theory as to why sounds convincing to me). If you'd like I can add those as well to be always_inline, as well so it's more consistent? thanks -john