Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp159228rdb; Sat, 16 Dec 2023 04:07:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJYgkkb3YgIBoaoUQyKjfWNVE0AjKNx+aFrBv13Xu69sWJ5Rx7UiWPOdF636/AFUir7TsB X-Received: by 2002:a17:902:b706:b0:1cf:9790:f244 with SMTP id d6-20020a170902b70600b001cf9790f244mr6768865pls.47.1702728473997; Sat, 16 Dec 2023 04:07:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702728473; cv=none; d=google.com; s=arc-20160816; b=fgUZuRtHim19cLbuEiO5vJmb9vhq/glxgh1UH2wgZtg55K/aLVIQZNvFESK/8Tvnbi Oa4h9UUcyxYdfSW2VkVetToJyyMbuPhrJL0x3xKYCEZl1V5j3d0UN5j5FEvJeIPxrdkv U7wNY2FPUfsvFUnLAOUZiMYPVOFQiIBKv6s+X53AMOm1W8a3PmCyiHIA0IkLXpNBxd8a aK1/3SHnS2x6E8lLlIXRZ6xBCJ62Wcb1UC4kE8WxFkztMfmOoDr215hT8puSG0k//mHh TjPsftH4pAodK35VBO+ALX9xipXduyT242aBlz+SrLhRZPCOF90zcn20WauMBlb/k3tK i1uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=eQ0asiDyEh5zDzuZXKXuWTZved4B2G07ODTKTMug6jQ=; fh=uhW2jSzmQLP3eBpy+DmKLUiPh3mdBn6eLb6S4GMTaCU=; b=HhqrwGB8ykk+UA0qiNDiIjt12F84ZxRCUHsp1SbQpKo1M6wqgQ7PU2cr42C6oCjq+O z/VrN28UHg5doO3hORlzW6zVMb019A5tnhPBDcJHu/QPA2cviDcrjFZZfUx0EuL3uOZQ 9WYzEhJ7rRVijuzFy1e3uoVQqS/0CR91qCOBztvj0TYm9RmLQT+TkxpPQGspxAgc23d1 xWchYIaFT3TmwfQ9LTWDrbG63rBY5iAFJfLzJIs+XiLeQicf1okIVFvRX80T74Ey2Bze sBqRmwQyxNsX8naaD5DsdkZTb5AWnP2rFK27uymZz0/O5xsUrOf16eEfbo18W4ZaqP/z V7LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=AywwhjmM; spf=pass (google.com: domain of linux-kernel+bounces-2170-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2170-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ja12-20020a170902efcc00b001cfcbf477c5si269891plb.30.2023.12.16.04.07.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 04:07:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2170-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=AywwhjmM; spf=pass (google.com: domain of linux-kernel+bounces-2170-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2170-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 052BD284E54 for ; Sat, 16 Dec 2023 12:07:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA93E1E4B7; Sat, 16 Dec 2023 12:07:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="AywwhjmM" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.smtpout.orange.fr (smtp-13.smtpout.orange.fr [80.12.242.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DA3D1E499 for ; Sat, 16 Dec 2023 12:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from [192.168.1.18] ([92.140.202.140]) by smtp.orange.fr with ESMTPA id ETSEr1N7v4QGMETSErWtUn; Sat, 16 Dec 2023 13:07:42 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1702728462; bh=eQ0asiDyEh5zDzuZXKXuWTZved4B2G07ODTKTMug6jQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=AywwhjmMlE5WvSV/6ewLSDJh3tO4w1L8GoVK66PJ9ZE0rrXhN63hmW/OjKFjmN1xb UgfGOHn15jEki0++JZgqa0WliS1fvSlsDS92wnt6xWyC0RyCPTZE7ybIcTLH73hOva 32CTgSfE8pJW8VOrOhQfIcqDf5cmi+iXXYUJ63CqmjK10JHE9t6pD2reI9AdwQSSwY JhFi8mQ/dhycY9Ns4ZfvU/AhzNiIO8bHac4ZYoK53XneQTOtx7PikgicAlLcPFM8pZ HbvEP3OkN2RZC+x8w5mi++Lz/UtlM7JqSrQ5FSBen5E1rlQrP1goOWq1AL7o7ULoK2 IzMFy1dG/K/oA== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 16 Dec 2023 13:07:42 +0100 X-ME-IP: 92.140.202.140 Message-ID: Date: Sat, 16 Dec 2023 13:07:38 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] locking/mutex: Clean up mutex.h Content-Language: fr To: Waiman Long , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Andrew Morton Cc: linux-kernel@vger.kernel.org, George Stark References: <20231216013656.1382213-1-longman@redhat.com> From: Christophe JAILLET In-Reply-To: <20231216013656.1382213-1-longman@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 16/12/2023 à 02:36, Waiman Long a écrit : > CONFIG_DEBUG_MUTEXES and CONFIG_PREEMPT_RT are mutually exclusive. They > can't be both set at the same time. Move down the mutex_destroy() > function declaration to the bottom of mutex.h to eliminate duplicated > mutex_destroy() declaration. > > Also remove the duplicated mutex_trylock() function declaration in the > CONFIG_PREEMPT_RT section. > > Signed-off-by: Waiman Long > --- > include/linux/mutex.h | 23 +++++++++++------------ > 1 file changed, 11 insertions(+), 12 deletions(-) > > diff --git a/include/linux/mutex.h b/include/linux/mutex.h > index a33aa9eb9fc3..f3ae911580bf 100644 > --- a/include/linux/mutex.h > +++ b/include/linux/mutex.h > @@ -77,18 +77,10 @@ struct mutex { > }; > > #ifdef CONFIG_DEBUG_MUTEXES > - > -#define __DEBUG_MUTEX_INITIALIZER(lockname) \ > +# define __DEBUG_MUTEX_INITIALIZER(lockname) \ Is this extra space added on purpose? CJ > , .magic = &lockname > - > -extern void mutex_destroy(struct mutex *lock); > - > #else > - > # define __DEBUG_MUTEX_INITIALIZER(lockname) > - > -static inline void mutex_destroy(struct mutex *lock) {} > - > #endif > > /** > @@ -151,9 +143,6 @@ struct mutex { > > extern void __mutex_rt_init(struct mutex *lock, const char *name, > struct lock_class_key *key); > -extern int mutex_trylock(struct mutex *lock); > - > -static inline void mutex_destroy(struct mutex *lock) { } > > #define mutex_is_locked(l) rt_mutex_base_is_locked(&(l)->rtmutex) > > @@ -220,6 +209,16 @@ extern void mutex_unlock(struct mutex *lock); > > extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); > > +#ifdef CONFIG_DEBUG_MUTEXES > + > +extern void mutex_destroy(struct mutex *lock); > + > +#else > + > +static inline void mutex_destroy(struct mutex *lock) {} > + > +#endif > + > DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T)) > DEFINE_FREE(mutex, struct mutex *, if (_T) mutex_unlock(_T)) >