From patchwork Sun Feb 11 12:29:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 199416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1902109dyd; Sun, 11 Feb 2024 04:32:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IE76H3dpUakD2n15OyKTHDX8aYJI/qqEq3ZyohXa3965/yekgvgOnO9vpCJkZ1Cb2oGXUZ3 X-Received: by 2002:a05:620a:4104:b0:785:ab10:bc84 with SMTP id j4-20020a05620a410400b00785ab10bc84mr8359562qko.6.1707654773211; Sun, 11 Feb 2024 04:32:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707654773; cv=pass; d=google.com; s=arc-20160816; b=yjrYjwC+FNfueTMxyH5QMC8X4+2xe3Oj4LU/AzB0ao6JsRZuqlyIA6Gq3mAwp35a+W Tj0EMkpDIF9XqFvwn0ZQ1WUqkGTsIAnXG7gL0L5/diqWiHpXij0OK5+RqHWqSJfeUDYI Snwc97maUeXMAyKCBuYeZx4XPY938lEzP7MgH4SS6gTRqT9bxt4/DOvIlkdLt1VM7+A3 82wcpIVeSCgDkmkKHi5wXDMd1yI/ylG+JYB32QXRIn+U6bOt1LvoYGS+ZUPMzty3weT4 E4BX3lPh27SLIKvQoI/m5G4Jif/hFyzRf/D5n95YHvfQrfM2NUOp5tk+5uvUlrdj3Rto C71g== ARC-Message-Signature: i=2; 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=6Sd3F7Cnejo0YUOQY1FFsProakPDnxze1sPdzTvGqZE=; fh=odIOevpLHj8efiZZ+F3nJnfmSkahWJzoLOD1RCJEeO8=; b=fyycp+dwSh/4WU9E1PLIK5YM9dDe8sNdujxR4nrYC9IzpMa1UdMDxAAuPpYOnL8o8U ZtzGZvT8KM6hSHwjrc6KexXUC97hIrXds5dHgcEUTU15yllO9vHdgK+4KgYD2W7HpGKn mG9FkZ0cememk//yApo45sWoZ6INJOQM4ShCqV6uOk+6858ydDKWvSbxRnW4Y+M9PESX VyeaJyP/r6JeKZ8k0XZHS/FsY+qdsM1u4Fb4n1A2V2x66tJPhky0LY5ixe5gLcbtAcSm qQMDc2s8ROB64sLdaQsWOp2qsCX7d9KFiQdSUtWVtPSafl3mJCqaQFXtfhPqUpFWvyut qfPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=ccs2UrMP; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-60740-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60740-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCWgSYS02UV5gd4gsYDfPelHpYuBmGakgP1GU0J6eWQCs1NEffxzZfDttSBwA/04JQqJ8VuczWdOxdtaLE6GrWUIo+2r/w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y3-20020ae9f403000000b007859e490176si3482183qkl.581.2024.02.11.04.32.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 04:32:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60740-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=ccs2UrMP; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-60740-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60740-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EB6E71C20D8A for ; Sun, 11 Feb 2024 12:32:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9CA75D75B; Sun, 11 Feb 2024 12:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="ccs2UrMP" Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 2AB6C23761 for ; Sun, 11 Feb 2024 12:30:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707654630; cv=none; b=H6Ae1sujboqNYN6/z3951smwpV5Vwcuj/MNoj1dTFA0FphpkSXq7r16Tmzn7KnpnU3xPdEus1tOO1HIg3mOslnsxKHhFlelXKTDkOEAJwWYQJGxMIAdchND96YPV0CJIgOfiVJ2lGXn6NJuJddnsZ4tEljPbHBzJ0QUixO5FAMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707654630; c=relaxed/simple; bh=sm5m4u4t8eFbR2gjJprfwSpii3UwlxNYAW+qpTdBofY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZXTrDUYo/h5OYixZj+WA5mjRCwPGzDa6WcrV2Qoh5M0SMCCf5fj6Z8sRTbk6Z0dyQNhJJWY/QSSko1tn3+oALlJpOT77rrhFkZLed8nBi/te0awMQtuq8Fvd3QWfcp7AmYFh0Tc5wZrVE8BCI7G7bmJDWqroMTxFCRxAkkLKWrM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=ccs2UrMP; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2d09faadba5so30560191fa.1 for ; Sun, 11 Feb 2024 04:30:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1707654625; x=1708259425; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6Sd3F7Cnejo0YUOQY1FFsProakPDnxze1sPdzTvGqZE=; b=ccs2UrMPg2hZMWxxZoYWR1hW8I0L86+3pa1yp7tnWuAVc9eH/C7ww5mQoBQpgFfiAD IRvTfMsXril+j58HVkHHoSirqAz/aQQXZ5Jrc6OK1sx+bnHqJF0k0REQ7TGXFOhgrlyf lJbinfSpvcxSPV00isFEI+lB1GSrp8Cajj445E0+4oCThUqMY4vbBPAOSSGkti/xLiSK yGuJQ2XmJvcWwgEvYvVnJzI5oqHeLhNFF+rRu0fVLmFNHPSnRDA+E60AeG3VbsbEjuVg n8jrl/AzPQEXif2bhEOSbgvhrg5hsXl/UJ/iEH3qYjk5iEKvxvaRMGGKgCPeWhoEUNQ/ QrtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707654625; x=1708259425; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Sd3F7Cnejo0YUOQY1FFsProakPDnxze1sPdzTvGqZE=; b=c8IWL1JMUdkxNwRmJWtVmHnBYZScwO52rNd5CcrAvgTWWVHhQ5rv3wARQMU14IYETV P5Nt58fnS3x0/25Jh1iU+WTJ+eW2PieBqITjTitZQWfaH4H5vyu9CthiHi/2HW++0UXq WIoPZstpmIc1WS+AmKp1cEiUnfXhfX4bP7/rViCZYhQENrl9G/husPMUJ6Rs0yf7oiqM +iPKmXZjfkBuqB82MEwcf43waoFnX1cYLGLBJW2FHKUb2NtNszovSXQJphTQ0LGa8mU7 uo1PPQfocV9QhEVyzwTu+H6Y5SnJD7NNpQrGi8PrgBrTr8+XWjzq9yE6egOKQjsuT5Ts Nxqw== X-Gm-Message-State: AOJu0YxjTbp7YBgjc4FWbcOLgLcuTLgHgetCqjnMlvbtiCgdu9pctwhK vKv0hgZZkdQD+kx2nuNxw0AStntpKTcogPzWiBJ5HN21wzId1hxFYd0PBNB82dicLQlsb22OPAc 7 X-Received: by 2002:a05:651c:1054:b0:2d0:e45c:5650 with SMTP id x20-20020a05651c105400b002d0e45c5650mr2452747ljm.11.1707654624989; Sun, 11 Feb 2024 04:30:24 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id fj18-20020a0564022b9200b0056187ca4120sm1024611edb.10.2024.02.11.04.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 04:30:23 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v3 11/35] percpu_counter.h: move declarations to percpu_counter_types.h Date: Sun, 11 Feb 2024 13:29:36 +0100 Message-Id: <20240211123000.3359365-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240211123000.3359365-1-max.kellermann@ionos.com> References: <20240211123000.3359365-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790605811092155699 X-GMAIL-MSGID: 1790605811092155699 By providing declarations in a lean header, we can reduce header dependencies. Signed-off-by: Max Kellermann --- include/linux/backing-dev-defs.h | 2 +- include/linux/flex_proportions.h | 2 +- include/linux/ipc_namespace.h | 2 +- include/linux/mm_types.h | 3 ++- include/linux/percpu_counter.h | 17 +------------ include/linux/percpu_counter_types.h | 37 ++++++++++++++++++++++++++++ include/linux/sched/user.h | 2 +- include/linux/shmem_fs.h | 2 +- kernel/user.c | 1 + lib/flex_proportions.c | 1 + 10 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 include/linux/percpu_counter_types.h diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 68fdec049456..720a88bb3513 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h index 35204b64addf..df9017a61046 100644 --- a/include/linux/flex_proportions.h +++ b/include/linux/flex_proportions.h @@ -8,7 +8,7 @@ #ifndef _LINUX_FLEX_PROPORTIONS_H #define _LINUX_FLEX_PROPORTIONS_H -#include +#include #include #include #include diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index a0011b6cd5d1..7c758ab565fe 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include struct user_namespace; diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 54caee378e77..a88219770c82 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -19,7 +19,8 @@ #include #include #include -#include +#include +#include #include diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index 8d45785b3448..bec5e7cdd476 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h @@ -7,26 +7,15 @@ * WARNING: these things are HUGE. 4 kbytes per counter on 32-way P4. */ -#include -#include +#include #include #include -#include /* percpu_counter batch for local add or sub */ #define PERCPU_COUNTER_LOCAL_BATCH INT_MAX #ifdef CONFIG_SMP -struct percpu_counter { - raw_spinlock_t lock; - s64 count; -#ifdef CONFIG_HOTPLUG_CPU - struct list_head list; /* All percpu_counters are on a list */ -#endif - s32 __percpu *counters; -}; - extern int percpu_counter_batch; int __percpu_counter_init_many(struct percpu_counter *fbc, s64 amount, @@ -131,10 +120,6 @@ static inline bool percpu_counter_initialized(struct percpu_counter *fbc) #else /* !CONFIG_SMP */ -struct percpu_counter { - s64 count; -}; - static inline int percpu_counter_init_many(struct percpu_counter *fbc, s64 amount, gfp_t gfp, u32 nr_counters) diff --git a/include/linux/percpu_counter_types.h b/include/linux/percpu_counter_types.h new file mode 100644 index 000000000000..faccd9869a5a --- /dev/null +++ b/include/linux/percpu_counter_types.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_PERCPU_COUNTER_TYPES_H +#define _LINUX_PERCPU_COUNTER_TYPES_H +/* + * A simple "approximate counter" for use in ext2 and ext3 superblocks. + * + * WARNING: these things are HUGE. 4 kbytes per counter on 32-way P4. + */ + +#include + +#ifdef CONFIG_SMP + +#include + +#ifdef CONFIG_HOTPLUG_CPU +#include +#endif + +struct percpu_counter { + raw_spinlock_t lock; + s64 count; +#ifdef CONFIG_HOTPLUG_CPU + struct list_head list; /* All percpu_counters are on a list */ +#endif + s32 __percpu *counters; +}; + +#else /* !CONFIG_SMP */ + +struct percpu_counter { + s64 count; +}; + +#endif /* CONFIG_SMP */ + +#endif /* _LINUX_PERCPU_COUNTER_TYPES_H */ diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h index 671ecee08d23..913da0aba05c 100644 --- a/include/linux/sched/user.h +++ b/include/linux/sched/user.h @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 2caa6b86106a..1d7e56eab60f 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kernel/user.c b/kernel/user.c index 28da71ea1e74..6c8b818419f8 100644 --- a/kernel/user.c +++ b/kernel/user.c @@ -22,6 +22,7 @@ #include #include #include +#include #if IS_ENABLED(CONFIG_BINFMT_MISC) struct binfmt_misc init_binfmt_misc = { diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index 7749a48428e5..1d5e1e0bdbbe 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c @@ -36,6 +36,7 @@ #include #include #include +#include #include int fprop_global_init(struct fprop_global *p, gfp_t gfp)