Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp7106394rdb; Fri, 15 Dec 2023 19:36:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkFJTeO4S5egUWQCe3JrBkfA6G9XkThQk+JOZ+SkIOp9oI9QIaGRqSAURrFBA71rbUFGmR X-Received: by 2002:a05:6e02:12e4:b0:35e:6ba1:7dfb with SMTP id l4-20020a056e0212e400b0035e6ba17dfbmr11432259iln.29.1702697813674; Fri, 15 Dec 2023 19:36:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702697813; cv=none; d=google.com; s=arc-20160816; b=AA8sHDz0veoIXMRqxCw5HCM5VffHJnECgkeM9hySCsHBPyKQTu6QMuPUpcLxvNaTqQ 89/T3Q7jyZCJE60P0+ja/kLUeM8VKm+50pxCHrAMWU7BaiJ1u+9xEMSC4PRg4S8qtz1v 80RDRXIvRMtPcjbHe+sODEgb9hAfYN6gq7SRhrZgHzzdUouL4elWRtuMqJP/VgKIqfac TF5Iu0O+SFGgbLuyEZjv+Rqi7MV0zXw6np6Hl/B0+HtOHMNQYgobeUJOWRiMxQVw/RYP Hp0UcnmqyzyghJAWS5/gER+yUbwXXjuRfPmUmYve61BAJqbI4qFfwMv1JECj2CXQb2GH vHaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hdKy4c2nBK8OI3SHb8BxNCiiiUgr6tnoyAXaAjNUd7o=; fh=vHhjxHftTECn/hRvIWNlq1eDzDsn74Roqz0kmRcPgcE=; b=QzRrjgnK7aEo+Hm1cTunMRpg8Hz7MhDdzJrRMSdgqkISg+sbrUUAjqP+TemGMzKiXo 5WY2/kG5fw06QzcRdInJXCYG+0rFaEnTfgeSNKLoV/8Gb/A4Ye+fg7L/Mhwiuvjh3mAs ct43iXCIqLMLYuTjOE9Tk/Y7hgiUP7Whmc2WCzVBWQn77kNoaS3XDqYyET8XYBTF/SPr /ElmgnyLGukCP4yL2b7ka1Meacy422eHE/IDRpqyMjIlPNh43TXQ4/kIuy/iYanM7hKB UHoJEO2LzGP1AwMPitfLASLmchnx3iQRnD2kQwg6xu2vFao5tdNdj5aivjbuljyZJYeg JDGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=u7h8j6yR; spf=pass (google.com: domain of linux-kernel+bounces-2018-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2018-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b12-20020a63eb4c000000b005be1ee5be76si13705817pgk.373.2023.12.15.19.36.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 19:36:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2018-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=@linux.dev header.s=key1 header.b=u7h8j6yR; spf=pass (google.com: domain of linux-kernel+bounces-2018-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2018-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 AE4D2286C49 for ; Sat, 16 Dec 2023 03:36:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD43D405D3; Sat, 16 Dec 2023 03:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="u7h8j6yR" X-Original-To: linux-kernel@vger.kernel.org Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 633763D0CB for ; Sat, 16 Dec 2023 03:33:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702697610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hdKy4c2nBK8OI3SHb8BxNCiiiUgr6tnoyAXaAjNUd7o=; b=u7h8j6yRy4W3KIP0uUc0t9IivyFOUHLizykuz/OutUHsq99rFa/O5tgPuwzqjJ0+TOXqYm dQl0x6e3yNEReAm6QbwM8WlNoe7FRV9uF4cu1Y3Pm4w1i7cWnQklA1javWWAGXQ2qehTNx EoDMjTpIhLYMCnn98EkX9mPxW7DV4Cs= From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: Kent Overstreet , 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, longman@redhat.com, boqun.feng@gmail.com, brauner@kernel.org Subject: [PATCH 39/50] refcount: Split out refcount_types.h Date: Fri, 15 Dec 2023 22:32:45 -0500 Message-ID: <20231216033300.3553457-7-kent.overstreet@linux.dev> In-Reply-To: <20231216033300.3553457-1-kent.overstreet@linux.dev> References: <20231216024834.3510073-1-kent.overstreet@linux.dev> <20231216033300.3553457-1-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT More trimming of sched.h dependencies. Signed-off-by: Kent Overstreet --- include/linux/refcount.h | 13 +------------ include/linux/refcount_types.h | 19 +++++++++++++++++++ include/linux/sched.h | 2 +- 3 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 include/linux/refcount_types.h diff --git a/include/linux/refcount.h b/include/linux/refcount.h index a62fcca97486..85c6df0d1bef 100644 --- a/include/linux/refcount.h +++ b/include/linux/refcount.h @@ -96,22 +96,11 @@ #include #include #include +#include #include struct mutex; -/** - * typedef refcount_t - variant of atomic_t specialized for reference counts - * @refs: atomic_t counter field - * - * The counter saturates at REFCOUNT_SATURATED and will not move once - * there. This avoids wrapping the counter and causing 'spurious' - * use-after-free bugs. - */ -typedef struct refcount_struct { - atomic_t refs; -} refcount_t; - #define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), } #define REFCOUNT_MAX INT_MAX #define REFCOUNT_SATURATED (INT_MIN / 2) diff --git a/include/linux/refcount_types.h b/include/linux/refcount_types.h new file mode 100644 index 000000000000..162004f06edf --- /dev/null +++ b/include/linux/refcount_types.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_REFCOUNT_TYPES_H +#define _LINUX_REFCOUNT_TYPES_H + +#include + +/** + * typedef refcount_t - variant of atomic_t specialized for reference counts + * @refs: atomic_t counter field + * + * The counter saturates at REFCOUNT_SATURATED and will not move once + * there. This avoids wrapping the counter and causing 'spurious' + * use-after-free bugs. + */ +typedef struct refcount_struct { + atomic_t refs; +} refcount_t; + +#endif /* _LINUX_REFCOUNT_TYPES_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index fea6d913e004..f52977af1511 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include -- 2.43.0