Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp873878rwl; Wed, 12 Apr 2023 05:28:29 -0700 (PDT) X-Google-Smtp-Source: AKy350YLZYhff/eVRUfbWdEMzOq9TYdVlbGv2rhd/0iXTBgJGVPQhto5JooEyuNdw1oG0rTu/sBY X-Received: by 2002:a05:6a20:be1e:b0:eb:c8dc:a565 with SMTP id ge30-20020a056a20be1e00b000ebc8dca565mr1478705pzb.7.1681302508677; Wed, 12 Apr 2023 05:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681302508; cv=none; d=google.com; s=arc-20160816; b=ODFvKHnapwmDBFPxicbivW6hAb2aw0iq/A80hwBf5YOhIQJKjb+Q92Fn2WNyce2/Ao soaMZ995yCFBlUcnGtcLjXQZkDC888ls3QhHR8yeiyWRTaVt9qc5wFgEUqdQRZud1mHO dzPgQoNT/3zeL00AjbCFBQcsRnEu3FIcdgZ9MGnF0kwgnWm9C6N+GUMY31WWeK7pa06G 95IxdixG4Jr1314Z9/rXaTB/uvDtsAyefDIJchN+7B2ksW+pQbJ+dGeqSq56z0qCWgVy Q/v6G3QXxlbuh45SSOKqIhuI1Z6SX7DQ7HDZzhJyDFZ6nlBXIkfOn1m053fDbOzKnhGi JUpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=7LSuDPeEIJ3aNmuAEBuRgkzCKJ5eoNSlQ7XYoj+AElo=; b=uH6gI6iVjKf8FPlij+uspEg04ZcrT7zFy6kzbV3qjHtnWYWBDAsRPqEzE2CH3LkBZH J6xBlGeNkdZ6ijNMuPzEinaKK0a3rtsZF7OnUXMZicZKv7oPp59mdx08JOZHeAqxtPRG 1Nzpw20Oth9FR66pMQcAexg2dDiPvAjVACICEJZJiZGg4uo6OgiQjphiGZLBkKYw8q6G 1yKsd+EJN2wWPMwkyqtalfEo2YLpXV0UEMVohqr7RFvjbsvAzCX+FP3XkyS7kr5lwGb7 MrlLutiTRKEWrpfOpX1P2KZ1lOKvMCjn0edPB98tOAYxirwERXsCWpw6kYw/XjpNOUZj ZeuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Nc6XkWtx; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v185-20020a6261c2000000b0062545446afcsi15373027pfb.165.2023.04.12.05.28.17; Wed, 12 Apr 2023 05:28:28 -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=@redhat.com header.s=mimecast20190719 header.b=Nc6XkWtx; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbjDLMLt (ORCPT + 99 others); Wed, 12 Apr 2023 08:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjDLMLq (ORCPT ); Wed, 12 Apr 2023 08:11:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCA7EB3 for ; Wed, 12 Apr 2023 05:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681301463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7LSuDPeEIJ3aNmuAEBuRgkzCKJ5eoNSlQ7XYoj+AElo=; b=Nc6XkWtxZywWLnhgpTuWRcrIv0o5ViUEMdFxH/VMCd/zapNwooUF4DW7N+9xEbqrEfisZv Q42LsxKEcbC10P1CnwfhWeOr56BiFEDUlraLqMt8x/aXwdyA1tMxZv6+zebWiIAcHjfPKZ tW0UXZFcv0Q4LY5zox0oiT93LGw1ahQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-401-R4f4V4tLMyiJOkqtc4FdMw-1; Wed, 12 Apr 2023 08:10:59 -0400 X-MC-Unique: R4f4V4tLMyiJOkqtc4FdMw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 257B48996E1; Wed, 12 Apr 2023 12:10:59 +0000 (UTC) Received: from [10.22.32.168] (unknown [10.22.32.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD7DC1121320; Wed, 12 Apr 2023 12:10:58 +0000 (UTC) Message-ID: <84e5f6d5-3217-e1cf-6a3f-c337a6737e5d@redhat.com> Date: Wed, 12 Apr 2023 08:10:58 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v2] locking/rwsem: Add __always_inline annotation to __down_read_common() Content-Language: en-US To: John Stultz , LKML Cc: Minchan Kim , Tim Murray , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , kernel-team@android.com, stable@vger.kernel.org References: <20230412023839.2869114-1-jstultz@google.com> <20230412035905.3184199-1-jstultz@google.com> From: Waiman Long In-Reply-To: <20230412035905.3184199-1-jstultz@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 4/11/23 23:59, 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. > > Cc: Minchan Kim > Cc: Tim Murray > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Will Deacon > Cc: Waiman Long > Cc: Boqun Feng > Cc: kernel-team@android.com > Cc: stable@vger.kernel.org > Fixes: c995e638ccbb ("locking/rwsem: Fold __down_{read,write}*()") > Reported-by: Tim Murray > Signed-off-by: John Stultz > --- > v2: Reworked to use __always_inline instead of __sched as > suggested by Waiman Long > --- > kernel/locking/rwsem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c > index acb5a50309a1..e99eef8ea552 100644 > --- a/kernel/locking/rwsem.c > +++ b/kernel/locking/rwsem.c > @@ -1240,7 +1240,7 @@ static struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem) > /* > * lock for reading > */ > -static inline int __down_read_common(struct rw_semaphore *sem, int state) > +static __always_inline int __down_read_common(struct rw_semaphore *sem, int state) > { > int ret = 0; > long count; Reviewed-by: Waiman Long