From patchwork Mon Feb 12 11:54: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: 199675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2377998dyd; Mon, 12 Feb 2024 03:58:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXgTPNoQ4MPsa6qZ8goBSMP7ehsybafSGfnvbitiw493aB+fihIV6d64hFPcHY+ipk/lhQjKG2lYOa4eE8Bnd4iWK6kAw== X-Google-Smtp-Source: AGHT+IEjiU6bdpp0evIilhfRaYF/G2U4YnzTahqZmtEtD1Z/cxr6INeqN2/Q/erV+8pP9P5KEkOq X-Received: by 2002:a17:906:44b:b0:a3c:aef1:e01c with SMTP id e11-20020a170906044b00b00a3caef1e01cmr1573423eja.14.1707739081103; Mon, 12 Feb 2024 03:58:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707739081; cv=pass; d=google.com; s=arc-20160816; b=cxLtYCQJZTBf1GZFb3TVJYgKhVAo0EdORZzgS/Atbg372lnKx5aRV1Ig+q2qaZoGIj J02vTzFbpBwyhHIIkw/jcchY/CWSEmq2A8ORQbOs4nqoPnOp894MSl73bHrZOKF5+TRt K3ir6h5M+Nuc8OyiRBJOsmCXFzTWsCec3K7qG+6QJcPGx4EOZSEzy/4bE3lg7r9Jfz5s 9ESDXZ7fn8FMcDLrMQesk8qNNG6/605qtiAu6A7oA6XF3sZGemdR61OXB0QszIvMs9/w AK/JNbBWcRjmhBxbdh42tdAG3mMrS7sN4TN7D4XGL8RDrZj1Ey5AI9nyndEyPXVgSe8p z5tg== 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=F8K4nT8S61H04Efn0LCL3Znj3VjONKPWqHqRbU9ADoU=; b=DQ8Nhygh6rah9ytNWxb6ZbFGiVUt6GvcrUY+P5nSi8F4yb7SAWAtoH1neqXy8QQjUE in40TlEY4AiZmRvbj4zCym3oS/fIUi+tmDVSwBfEYErjXAXr7Er1oIP9JeYBXaxwiHVr 5AAf3YM82x4ifLF0DRBP9jcYxRl8GztuymkTbdB90vCan5xuForGKctXox+dVSRh+fr/ ZlGyAT54juLXYr0AAm526mD1sqNmN8BHUgkwYuJFr2/Ellr2gTnEYOom1akHy4MrI32i TYw3WpDr0ZhbsM3gRtb6E+Cr8ymWBtN5pJme9GOhk1KNNyfdFZaPlE0SQyu1kjA7kG6e iP9Q==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61471-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCUHzfbq5gW8ZfbwyjdcEE4n2d/tuUn6hoqohH/L9EqrA/66+xpn/Y7zDxQ4XBHy14yNGoxRScDS8dcgnqqnP5DxI5iUZQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qt21-20020a170906ecf500b00a38159238a0si122859ejb.138.2024.02.12.03.58.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 03:58:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61471-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61471-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B319A1F27952 for ; Mon, 12 Feb 2024 11:57:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D3E43AC19; Mon, 12 Feb 2024 11:55:36 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790694214397145052 X-GMAIL-MSGID: 1790694214397145052 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)