Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1045445rdb; Fri, 9 Feb 2024 08:41:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoETbVXU0xOivcrS+FIp6eXyU41LzwJZhgRQIYy0kwuseQzwtyLgsQkgPT0RPrejsrqqX5 X-Received: by 2002:a05:620a:25d6:b0:783:c889:9887 with SMTP id y22-20020a05620a25d600b00783c8899887mr2016072qko.18.1707496910132; Fri, 09 Feb 2024 08:41:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707496910; cv=pass; d=google.com; s=arc-20160816; b=qNy9N1pExgfRFaJ9d7ZA2SDR85HYUWEQnoVTt5iuwR+bRK1lzOiOXuK1iCqHWltMeP PdfnHQ10/MijJy3/uoV6oTY6SB9HhZvUqCc9bvglNaIi3rAmhZovlwWj0Lw6AWe5sOHQ GT1E3c5ge2Kxp3onPn4Diod3tI6AeUyTvZ+HBXn4KhQNIiVEnBeurfI0j7x3h3iIhnUF TtF0poI+ciGJ6rBHAkTLq3OEcC0LMA6y0Xytr5GpT4TpXuvynrm5OEHb2vqmXz63Jty0 jUL4uhVzgwxJR7ALHM6vBr03lCeJKaE0AjULobObrXTByUVSeoyhVLH6uWCsbW4nIxZT UlfQ== 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=rDRTgs4aFjSgZGv/2kmGoIQZbfsa+Sj6ctbIY2wFSfw=; fh=1F9wdUVNz0ZaISYVdVxt0ceDPItzQULL/h9yjjFSijo=; b=nWDdWh/kvT++JHd9Ux2mbiPkYYc6KDGppCp8iR/vwbSZufEitiGx1p2It31b8h3SHu 1Bbd10OlcCmBh+wdF0mJVvXzWqpbFtnOB1RC4SO83pbjF333hBn5WYQWCmdiFyzegbr7 d/FEdc6RKIiHnyiHymFaSqYkZC0f1OuL/GeoC8taONPh6+LHa8zN2R2rMFwFkuR/ezIU XHwT2u/NWX/3vUQRZaIpvYvV5avXeNXE6JnJYlEmVQUhP6SVWtYxBEXk/uZwvIttGsG4 wcwbVfJpNgjn9CktrLY4RFhANZVP+0d8XOe76i8PWw4cOnOBFq2c0i3qB1U/FBaKmaev eWuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=f7N4R7Zn; 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-59630-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59630-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; AJvYcCWLTSCE74JVyJ6AGrL7ASC1r/ebtwfMQa0EjkwsvPvZDVs69ruIDL6tZg7scLZeHgc1zK9It141mQF71olTWBR1n/Tx207ie3VjqmN+rA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y22-20020a05620a44d600b00785ba1281acsi1348071qkp.458.2024.02.09.08.41.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 08:41:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59630-linux.lists.archive=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=f7N4R7Zn; 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-59630-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59630-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CAE501C228AA for ; Fri, 9 Feb 2024 16:41:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 354127F48A; Fri, 9 Feb 2024 16:41:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="f7N4R7Zn" Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 D03927B3D9 for ; Fri, 9 Feb 2024 16:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707496860; cv=none; b=T87l6zlhAeOXKcpoSP67suorJXcmlBWhs3llOlZZuJEtny7TS/l0NJ3w7CieXBNHZkXJkgyXthPZGpYnP4GBKhqiWruEtpPWI8udrxr7rx+DevTW4xqdxTUsS12xG5WfQyj8mZ9szHqgA8ruFtplkQMriGjI54BilngNx9W+0Qk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707496860; c=relaxed/simple; bh=4CJZzLKHqNM0uZiH2QQttaGMDPfFliJBBIA1mtreQBM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aROnnbiK4Wq3tq53ZaHfMXocHpT6H2RbiGRj9zDyaQiz529lRtwqZu6wh1ixi4WDH6zHU7qMVyD0gxi1hJfvakqBkuTYg8hx+pQAzKZJEmS5AOwaEm26JDMSdFdRutw4OOkzq7xZasU5hqrlIiTPHH2JQzoG9of3JSe5ZM6ghKc= 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=f7N4R7Zn; arc=none smtp.client-ip=209.85.218.51 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-ej1-f51.google.com with SMTP id a640c23a62f3a-a3c0d92ca8aso38781966b.3 for ; Fri, 09 Feb 2024 08:40:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1707496855; x=1708101655; 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=rDRTgs4aFjSgZGv/2kmGoIQZbfsa+Sj6ctbIY2wFSfw=; b=f7N4R7Znpuba9KrDBliMvlzFOzC0R8/Dm73sj9FT6NGTijQG8kh5Nlmc4IVy5FMCvL 3D+VjjGMQmq5L1mRlxC6RKwU1N12NdX+sqP3BPoRr4rV/sdGgzxzF/CUh6cQkbF9w2tV b2vSx1X9ZCoE+n5I3HGMZ1dhHXgwCVg50Yn/Ho4GW+1vpZ6vpvX3u86KHsZn2hGOhX+j chi3TUQe0LT9zbw9/ux0WyUXeNDLdOMYqwgFRSW2Rsr8WLalqDJa/5NapzB9NMmd54LT RVe5YYFGkKIuhn8G5DUbYTbbmd4J4P/k0NasNP1TmZPKHM58GWIUYV8aSYf56zQR4dL1 q8zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707496855; x=1708101655; 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=rDRTgs4aFjSgZGv/2kmGoIQZbfsa+Sj6ctbIY2wFSfw=; b=A1l77nYNlFawoBFikrZSkXiAmPSIf9pdDu0pKruQUbZHAf+/ITCROdheQSAb1uC+AY BSS4k53e9RsbzazYT+PugY7nQrBCMlOR+fmfLnJzjpkrBbE5NZggti9GBJPhVMB14ow6 QhiH2sVoTuz7XA1yphnHpVFmH6rtqY/KapFcWWiAbbZ/c2epFvWONk29iqGl5wAfeNZi Opf7kkWHrFNzN03+NcqXEgMQQOXXe2MqrvQC99SSMwC5RNbFgzj75iFSAluFbOLdBxT+ x5r8SFBPrd/hGH4EP17lr80QCd9bEtvBccikWdAEsXlzzcUR9bzaIMqaPYtIYUJfQvHZ +44A== X-Gm-Message-State: AOJu0YwULZh1cePp17LpMseWVY2VNL3ha649A6BOi6XMikgoikEYYQTv 4qZVq5SUBDa/ro005Y+OJJSEIR3nQlpx1M+pyz7A7DZfsbZzx3QbV6bTTcaymHNZBrwglGqLHKK l X-Received: by 2002:a17:906:792:b0:a36:ff9f:4256 with SMTP id l18-20020a170906079200b00a36ff9f4256mr1558501ejc.54.1707496855757; Fri, 09 Feb 2024 08:40:55 -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 tl27-20020a170907c31b00b00a3bfe97fe27sm477724ejc.218.2024.02.09.08.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 08:40:54 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v2 11/35] percpu_counter.h: move declarations to percpu_counter_types.h Date: Fri, 9 Feb 2024 17:40:03 +0100 Message-Id: <20240209164027.2582906-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240209164027.2582906-1-max.kellermann@ionos.com> References: <20240209164027.2582906-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 35784f94f0a7..967626b48bd0 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c @@ -34,6 +34,7 @@ * which something happened with proportion of type j. */ #include +#include #include #include -- 2.39.2