Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1936346rdb; Sun, 11 Feb 2024 04:31:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlXOGx3r4qTNxU92slu1h/HIKo6R9GNUMH98tPg8DQmEoLHi9FjTaSLM9Bj+3WM49hiTnR X-Received: by 2002:ac2:5ec8:0:b0:511:76aa:3e37 with SMTP id d8-20020ac25ec8000000b0051176aa3e37mr2751325lfq.53.1707654705632; Sun, 11 Feb 2024 04:31:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707654705; cv=pass; d=google.com; s=arc-20160816; b=kacBJQv3zWhEf4DgA0tn4wyMvfKDUhD6moHqPZanQVH9ReuWNHZ1ckEx+MyVAndsxN fnJXW52vfNpK07bL2mVWewYn9DtrkaB7EJmiA7u6Giu+Xln8hrDRti+UXPts8gDJolj1 Lc8DqC0BHPmskEm3AOJs6mBZFx+L3edYfydfSi5oEp8ak0cu1GVLrWGX0WMoiVURFLOa wY9ICfUJulqAsNN7MQpxBShETCdRZv54fmNMp+zgg4QwyKOGnhyJ8DXPiLhxMeCG5yxn 2ZTTdDeMkpNNkm5c/HBS8T3hvZZ4pEmJZUJf6Hlfh+MqGtijYvTSFe2CYYYohUMhAtOo JBjA== 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=ZzZ7JwJw4HqXeo+VvF/d36sesu4svAGxhSr5D+VBfzA=; b=BgnpMVAaNsZDuCw57u1wsggwJ487Bz9XnOefM8X9RuybTHHulJq7/oCzQQSo/s1sdH apL5WFsTH2XzBT41FncoWG0Yb7MJHK5Y4CAJQIGPBltUJYEzcGAupxPg+bmQM5+943Ya 5Cr3hb2gC5qD/8fJI2HtwvK4b93W9E0hxo6GELPkQET7jXkxUgl5puMd8HXMf7+1Ers+ 603TTs0ijfFIlr0djsKQz2gejKJ26pNiUkr2oJgD6n5C3R/Gs2U0DwGoObeOX3JbGDW9 KbdoDymAbguP03ziECqeU6ncR4XBLudcTJUiCsGWvVH6n0jGEkVccbM0vo8WegF0LojW VVdg==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60740-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCVjE3Avvq+Z6Hm+872p50Vc9YIDfvW1zyBDPW72pOVLkjOa6cWwdZ63CbY+2wR67l6/ihomxxWxEwDOip8Y4EKgNFmOkDuO5dnbA3CDhA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k11-20020a1709065fcb00b00a38815c23edsi2813450ejv.778.2024.02.11.04.31.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 04:31:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60740-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60740-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2B7CC1F2168C for ; Sun, 11 Feb 2024 12:31:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 505065C8E5; Sun, 11 Feb 2024 12:30:32 +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 Content-Transfer-Encoding: 8bit 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) -- 2.39.2