Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2402020rdb; Mon, 12 Feb 2024 03:57:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVhU2Wb9kI6pc/3hF0ktOILrrFTnHCISS99LQM+nGYqD+SkOVpZn4FvUZoCsw4B2/mfmA+n7qzBS+9OPexA+4D4VxmufWi7A6EKma9xBg== X-Google-Smtp-Source: AGHT+IHfmK1zXMpBuCCaTqcCMsX0qpRAbZmrjm0sVMZqgjGRjCWil/DDxs2NeOy7sOa0k4ZAHFS9 X-Received: by 2002:a17:906:af1a:b0:a38:43e3:510c with SMTP id lx26-20020a170906af1a00b00a3843e3510cmr4391523ejb.63.1707739069862; Mon, 12 Feb 2024 03:57:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707739069; cv=pass; d=google.com; s=arc-20160816; b=k72OQW8QKZmHcVWGQ1J8SkhuSLsVQq2Q3hgkxSv1YkO27l6b/vJr6Xe4DxCvxb9aA1 GJ3sQx8jshg+e12kDnTK2QCwhgYn1sGwo0lToDPqAqJObBuU4ulim3ngfbAQe2XIxRei ip+fSlRBqI/wc11eySYyGbllmy3IWdlm2mbpeyncdAuFfnb5TdZBNGREqsDICcY6086L y8ErCqzvVcHt405UCnClyh+82hTWGTeTHJcg42DyZ90PbAkx+NY8GKQlWXBv9uxvS9p2 13fvun0TR9cfuEnz4hp2Q6ai9Kr08u+ZvD3kjP3vplnmFPdEe63bgLNHnBkY+B2O3umV AtbA== 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=fpANRYXvs6zGbuIzmy6jouZw9SrrvoBI/ftf7n/DOy4=; fh=lE5pKmdjV9Gspk3IsPh9vnGrpaz3DsYRMXNWTzUlFyM=; b=YpVAs+lTIGwZHUcSRnyzt2D5xllaZ6489XlB6UYDNMXJJ769KAH2b6rmaZQ32nzWeu fRPRyDe5+ZQeelXFUh45ztiT+HLyJR8SA25Jft4n//j9SfARwESX1RoCzZcL1xgW9f1q jqP2UFn65aoC1utcz56VBTjgwrQhn+1i4bzuX/V6hx96P2rIVunclt/yRvr8eGcyYMCZ NlIcwDSZdFXiJ5edRyGC8fY+1Hjrf6v4tdZKQAhUY2wm8+ASC3bxwXsLE60X/89ffKKG 2g0lzy7fixj4UHNEcEJ704gT7vZ+OVGTfwPK2VyyDIyONlDkzfpn+xvVMHCZtyVpvomm t4lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=ZVkb+Iiv; 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-61471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61471-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; AJvYcCV3dBk64XMzWfR/HeDd8gUqzVzA5MuQRfjdTs23h4JKmf+wYdMOo1Tk+7GfnWG2KPqco5em5SQKMiEHB3xCcOvnreyxRzaMziEz4ZRsvw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j14-20020a170906410e00b00a37f77efc4fsi117392ejk.790.2024.02.12.03.57.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 03:57:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=ZVkb+Iiv; 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-61471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61471-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 F40881F241DE for ; Mon, 12 Feb 2024 11:56:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4D3C3A8C3; Mon, 12 Feb 2024 11:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="ZVkb+Iiv" Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 DEF5339FDA for ; Mon, 12 Feb 2024 11:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707738928; cv=none; b=boUVpDuoFoKJRtWEQIpVFwhxulxANmd2yEzZdt/8o/ocVbTCo/wxuq6jeETvZUI6wAkS0gHcLxgVxhCd9noqYWzpFjBUW9e4sy4SsYtJaxj71vCw+ywV77fiJJL4LpIaztjQ94cyjsEUK3NWN/H81s4KVMK0xxsqZwuFLzWR9bs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707738928; c=relaxed/simple; bh=VakhuskCOEmdUKNKG6h481SR/1QpIv5oUGc9vY942tw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DDvV6k/lgPhk3dKuBTWTQgreh+uNa0GcL1msBbSjJl6WlCX5prj2ofRFB5fRuQMYd7dAIjD1E1xeRFRdKUU9d5CYySM8LWikkFjT/q4hQs/w4PCvQ9SKPzp8lLdg2fRheY/6VaWuRHayZWMyHz+0yoLpfaXRmvFZGI2gQmmLYMM= 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=ZVkb+Iiv; arc=none smtp.client-ip=209.85.208.50 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-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-55c2cf644f3so4016150a12.1 for ; Mon, 12 Feb 2024 03:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1707738924; x=1708343724; 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=fpANRYXvs6zGbuIzmy6jouZw9SrrvoBI/ftf7n/DOy4=; b=ZVkb+IivFda0raddP/sOm0aCNdDUxXzYARJGuyXKfwrxRDja2yMDAZz4jqPfhb/r/P e7/orZTR/t4ta/uuujnZro54IdehPrjXFDE6AtsuEinxVsKsHp2JZaqvC0Ik65SNRxLh DbVD+4Iro+qfNOiWr3h5Wv3EXJRBRsFJfEcj+MvGm7l/qktD66nGeCMyoCtIzueK7fcX zwieQ6xvyKpwaOIRM0kw0QiIRrWdUVUjF5e+nsHqW4sn1qMIWQFmDXbHPXRNQ5Ew7Z08 UhccxxAX44nWDNMlYf/5tacfzc6LyuvJUC5NoHnlVbKz2DabWe4IsJhKQXniIX8wI1LL JdDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707738924; x=1708343724; 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=fpANRYXvs6zGbuIzmy6jouZw9SrrvoBI/ftf7n/DOy4=; b=jh8ZU23Bbj6MrLXsmaJL6udgCCE17l8ncMgd11/Qu3BHVEDrRV7JBOhZ06aLlWXvoa j/jS8Y39/eR5a5CLn5BWzotyMR8rr09TPdtrE5JbbEQnHglCANS3qGToXhSzR8UVv0JF mrvYe9AOu3cehJmfMPF1aZEM9MF1iXSTf0Ri6fU87ugwiaom6a8Zy0WCcjTHQSHjYCvT 5GAI3Xqq0IKDhiuyjJdzJILhtfqZF3Vh5Pr55Vh9nl+yjiESAwlT/MMVpUhWpmdxtEM3 pdadqD6i9oaGJEb9ZhjbOcqRc1T6SyRZclftxq0Eo/KOBw9WHnTOJoEEO43+vxNLtSIT dFlA== X-Gm-Message-State: AOJu0YzeAPvA3MUXF7JxIFAbqUbRwS8DAAUvQxf5fqauivKc1sI6q7bF SwrtgJFkFuJ4RVn/c1xasSiVm8PhMJTiOaWjT14tfCuRKi7TwaLiQUdGkcTbOhMa0pHK3YFRYHz K X-Received: by 2002:a17:906:84c:b0:a37:4c04:a472 with SMTP id f12-20020a170906084c00b00a374c04a472mr4236449ejd.18.1707738924077; Mon, 12 Feb 2024 03:55:24 -0800 (PST) Received: from raven.blarg.de (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id m1-20020a17090607c100b00a36c3e2e52dsm139203ejc.61.2024.02.12.03.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 03:55:22 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v5 11/35] percpu_counter.h: move declarations to percpu_counter_types.h Date: Mon, 12 Feb 2024 12:54:36 +0100 Message-Id: <20240212115500.2078463-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212115500.2078463-1-max.kellermann@ionos.com> References: <20240212115500.2078463-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 ce5bda191ec5..9f2ef799cff4 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 91e3a527ceef..84f58b8b7856 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, @@ -133,10 +122,6 @@ static inline bool percpu_counter_initialized(struct percpu_counter *fbc) #include // for local_irq_save() -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 66828dfc6e74..56b11f1f82c5 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