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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59902C35274 for ; Mon, 18 Dec 2023 18:13:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D80766B009D; Mon, 18 Dec 2023 13:13:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D09286B00A1; Mon, 18 Dec 2023 13:13:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD0806B00A2; Mon, 18 Dec 2023 13:13:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AC1236B009D for ; Mon, 18 Dec 2023 13:13:01 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 780C880163 for ; Mon, 18 Dec 2023 18:13:01 +0000 (UTC) X-FDA: 81580735362.14.F7DBFC4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 7152F100025 for ; Mon, 18 Dec 2023 18:12:59 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RvPlVgCO; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702923179; h=from:from:sender: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:dkim-signature; bh=Cr06QuF3rqXGM0lEDf0Zam9OMb9ZlxtmpjelXPxsrrM=; b=oAgMDU2u6hOEsq89sPkLdxK/Ty2MDtcQrHmhIu9Ry/EDnVqmvRHuHFgWZmVqCcehOyQtyK QfvAoQeax7vJba173fRDexAzG9JDgt3AXABtLmW9AKSz8rJs1Z+acWxzNGbFDR85xXRxF5 weJ7XqDBwchzo0aD0ZknxpkQz3DWv8o= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RvPlVgCO; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702923179; a=rsa-sha256; cv=none; b=DX7oD4Pz0MfUcvxqLkaJz9G+EcCkyLr17m7UjIJOzGpS4CRQmPFrgNvMaxculyC8yGV3tW BvxI2U8cWRMkYHZvWKgXQq+GX7A2E8dGR+ejzSXBTuoGPHr/7VoG+xcparYf1MIT/p3rsS 6dLTRkKksi4Es5/UoBZXgRBJ4Ly+574= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702923178; 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=Cr06QuF3rqXGM0lEDf0Zam9OMb9ZlxtmpjelXPxsrrM=; b=RvPlVgCO6Ffai7q5Xh0/wqvYRJZb9rqCtwEh3LFf0G3PnysI7tASjqmXL9XjwNz+wE+EMu 6vw7I4PoJrHlCHbIOg+a0gyWt6N2//0rnM7sbLswlGBLdYHWpYvfz9nQdzT7Aq+hqvoCtA j/fokDSJmKvTT0yB4KX3Vo1Xq0CCs0k= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-x3tSkIYlOTmH7IxH_NaibA-1; Mon, 18 Dec 2023 13:12:49 -0500 X-MC-Unique: x3tSkIYlOTmH7IxH_NaibA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D939D1C06359; Mon, 18 Dec 2023 18:12:47 +0000 (UTC) Received: from [10.22.32.252] (unknown [10.22.32.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9757B2166B31; Mon, 18 Dec 2023 18:12:46 +0000 (UTC) Message-ID: <2ef22a69-e19b-4456-9d01-151c4b4a941e@redhat.com> Date: Mon, 18 Dec 2023 13:12:46 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 19/50] locking/mutex: split out mutex_types.h Content-Language: en-US From: Waiman Long To: Kent Overstreet , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: tglx@linutronix.de, x86@kernel.org, tj@kernel.org, peterz@infradead.org, mathieu.desnoyers@efficios.com, paulmck@kernel.org, keescook@chromium.org, dave.hansen@linux.intel.com, mingo@redhat.com, will@kernel.org, boqun.feng@gmail.com, brauner@kernel.org References: <20231216024834.3510073-1-kent.overstreet@linux.dev> <20231216032651.3553101-1-kent.overstreet@linux.dev> <20231216032651.3553101-9-kent.overstreet@linux.dev> <7066c278-28e0-45eb-a046-eb684c4a659c@redhat.com> In-Reply-To: <7066c278-28e0-45eb-a046-eb684c4a659c@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIME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370c12njG8lXM/rzrwavX+5ERGVgSKrkCkKFUhirQ rZgQMUj3 qJnh+GBsaTDXtAsoJVa8rd5u66F7pBkCBhM+gz1BVU1A1AVL0x3oOemI5NrTiOx1tX/kosnVuRYJx5uG51bqkjjEfgrTbEx15CEFp2H3S8/wUqpgyEWDNGzIok1Lk0iYPo4nfyAVksA2AkrNDP8lfhUCZ/lb5J1zOFFxuPmluj9/XLqIjOI+pHGHBAew2E8SiZ5T5RJQZfL/1lHGmS3PbAI+PqhRSYuzpPlN6fE1LhFvfiEJWo7XUwPbHNiP0JBrHY4y8w8QNA9PjTRyQkWbFyWLdbtDZJyZ+ZsbQ5E/t9flGwfLCk7DOK68DvMuO3zJXxWOdJMbSeoTZXNlobScFbznjrsH0N1yTB5WXA0Wgcm9WygxY/24ghkgvCgDycgIFVXo2VW3WAgjigzlTsWBEKjnq1x+Ab6tKDGkhgHKhkC0/QzdrXMfzDFN35H/cL1K0nePZIZvWz6+juDhsXg7LnXRzGuuMas0auVyEe7LE5/q5GBs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 12/15/23 22:26, Kent Overstreet wrote: > Trimming down sched.h dependencies: we don't want to include more than > the base types. > > Signed-off-by: Kent Overstreet > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Will Deacon > Cc: Waiman Long > Cc: Boqun Feng > Signed-off-by: Kent Overstreet > --- > include/linux/mutex.h | 52 +-------------------------- > include/linux/mutex_types.h | 71 +++++++++++++++++++++++++++++++++++++ > include/linux/sched.h | 2 +- > 3 files changed, 73 insertions(+), 52 deletions(-) > create mode 100644 include/linux/mutex_types.h > > diff --git a/include/linux/mutex.h b/include/linux/mutex.h > index a33aa9eb9fc3..0dfba5df6524 100644 > --- a/include/linux/mutex.h > +++ b/include/linux/mutex.h > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > > #ifdef CONFIG_DEBUG_LOCK_ALLOC > # define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ > @@ -33,49 +34,6 @@ > > #ifndef CONFIG_PREEMPT_RT > > -/* > - * Simple, straightforward mutexes with strict semantics: > - * > - * - only one task can hold the mutex at a time > - * - only the owner can unlock the mutex > - * - multiple unlocks are not permitted > - * - recursive locking is not permitted > - * - a mutex object must be initialized via the API > - * - a mutex object must not be initialized via memset or copying > - * - task may not exit with mutex held > - * - memory areas where held locks reside must not be freed > - * - held mutexes must not be reinitialized > - * - mutexes may not be used in hardware or software interrupt > - * contexts such as tasklets and timers > - * > - * These semantics are fully enforced when DEBUG_MUTEXES is > - * enabled. Furthermore, besides enforcing the above rules, the mutex > - * debugging code also implements a number of additional features > - * that make lock debugging easier and faster: > - * > - * - uses symbolic names of mutexes, whenever they are printed in debug output > - * - point-of-acquire tracking, symbolic lookup of function names > - * - list of all locks held in the system, printout of them > - * - owner tracking > - * - detects self-recursing locks and prints out all relevant info > - * - detects multi-task circular deadlocks and prints out all affected > - * locks and tasks (and only those tasks) > - */ > -struct mutex { > - atomic_long_t owner; > - raw_spinlock_t wait_lock; > -#ifdef CONFIG_MUTEX_SPIN_ON_OWNER > - struct optimistic_spin_queue osq; /* Spinner MCS lock */ > -#endif > - struct list_head wait_list; > -#ifdef CONFIG_DEBUG_MUTEXES > - void *magic; > -#endif > -#ifdef CONFIG_DEBUG_LOCK_ALLOC > - struct lockdep_map dep_map; > -#endif > -}; > - > #ifdef CONFIG_DEBUG_MUTEXES > > #define __DEBUG_MUTEX_INITIALIZER(lockname) \ > @@ -131,14 +89,6 @@ extern bool mutex_is_locked(struct mutex *lock); > /* > * Preempt-RT variant based on rtmutexes. > */ > -#include Including rtmutex.h here means that mutex_types.h is no longer a simple header for types only. So unless you also break out a rtmutex_types.h, it is inconsistent. Besides, the kernel/sched code does use mutex_lock/unlock calls quite frequently. With this patch, mutex.h will not be directly included. I suspect that it is indirectly included via other header files. This may be an issue with some configurations. Cheers, Longman