From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A62AAC77B70 for ; Wed, 12 Apr 2023 02:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbjDLC7s (ORCPT ); Tue, 11 Apr 2023 22:59:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbjDLC7r (ORCPT ); Tue, 11 Apr 2023 22:59:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B487D4482 for ; Tue, 11 Apr 2023 19:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681268334; 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=qARMtEZ0RiQtHOJb7ePJUZ0m60eyXWotzhsryqgO/vo=; b=PMH2S1QhYp0qoHjUisziCe0+xeNhe0t+6shnigQp606mOIqkpn7IhN1KXeFUSOHp429Wia d69EHQaUohS7tcxx3fJNyw3BEjCi/TKgvfwLZBngSD54C2T8QbjsjUaN5Gs10bgiKw1rOz z3RBmi2BjlrkvB3eUUNQ29NvEQxrrao= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-106-nuHn94c1OY-FTW1BBqmwVA-1; Tue, 11 Apr 2023 22:58:48 -0400 X-MC-Unique: nuHn94c1OY-FTW1BBqmwVA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 352992807D62; Wed, 12 Apr 2023 02:58:48 +0000 (UTC) Received: from [10.22.33.155] (unknown [10.22.33.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF9E1202701E; Wed, 12 Apr 2023 02:58:47 +0000 (UTC) Message-ID: <5e7d733c-7272-d202-c80a-f8e8f23478d0@redhat.com> Date: Tue, 11 Apr 2023 22:58:47 -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: [RFC][PATCH] locking/rwsem: Add __sched 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> From: Waiman Long In-Reply-To: <20230412023839.2869114-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.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/11/23 22:38, 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 __sched annotation to the function so > the calling function will instead 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 > --- > 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..cde2f22e65a8 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 inline __sched int __down_read_common(struct rw_semaphore *sem, int state) > { > int ret = 0; > long count; Change inline to __always_inline instead of adding __sched. __down_read_common() is not supposed to be a standalone function. Cheers, Longman