From patchwork Fri Feb 9 16:40:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 198982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp979060dyd; Fri, 9 Feb 2024 08:42:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnIAd5ufiHoK94Q5ZjteAz6mw0pqdrG06w1Mmea2b+5vMi9TfxRilZ9izv5sC9Bh9AT8VP X-Received: by 2002:a2e:968e:0:b0:2d0:9d8b:719e with SMTP id q14-20020a2e968e000000b002d09d8b719emr1756768lji.4.1707496972592; Fri, 09 Feb 2024 08:42:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707496972; cv=pass; d=google.com; s=arc-20160816; b=EtkFoMFzhIjRKuBvOGh8z2wAvturD+I1cWptshBBNjh2wQN8PdkCTkMtiHtUxq/JUQ d+s92uIdqFw2qzunSuOrAOVO4J9wLioltRy1fbZHd8pThmxhokNlauyOLb2kuBAKPkBX cUjqQD3hsJ+Zw4IP8q4vDakjq5IBRF7JwRUGRdLumAyQPCVk4cpDCGaEk5nWed2bVy7z dHwN5cObMWNs55l7FS742TYHswdg3ytJZ+gNrDiuwJGkcyQLSk0VYEFsEDnqKvM5IW64 oMc0fo1m4stPQIUw1By3sssvlnb6V0Z3/WRIvtnC9vhY+5NdnDuhqpii8plbeMl6BTEH sRdQ== 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=3C+XcHpOCkH45gZsEZGo9mv8vCmnzWBEFWJgg/k4JOs=; b=S6XqSrQCzAJLjhpxpo+xNMPefvhg3ZqyC4nlUd2tbMOWDJ6Etz58f3mQKMiZnmHx61 kvtpIKCuYBABmon4PsmO1U9WvAedJJ3hGdcRVYsW8cG0u91lhABGjVCoDqsnqJcm3Avy zXil7zERkbSuwdWvwCgE7+C+Y6FneobH4wclrDs3YpqsbL5PjG3loDFI95auNQV5uLyt Vb3BDLjABP3kI9a+dfyYv00mv752XlS0IQDm9UHq7Eag2Fv6D3wCr1KHbWeEbQHAw61U Hj9GWStzdrfHJzCoaTCmaNaFo2vHQrBDU+GQrBfHSavtM4Dy03JBwNbDslc2Gyx/Wz00 uvMQ==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59630-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCXjzT56L26QQIai2DhcPAQJzpeJXX2tse+LhkQC/VqWSSgUhhyoALfXtRI2qrKS29PFVruCKhX9Bse1yJxSQteHuBfKAw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v18-20020a056402185200b0055eeadefccbsi967397edy.654.2024.02.09.08.42.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 08:42:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59630-ouuuleilei=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=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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59630-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 0436E1F2463D for ; Fri, 9 Feb 2024 16:42:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51D6D84A37; Fri, 9 Feb 2024 16:41:09 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790440345262321445 X-GMAIL-MSGID: 1790440345262321445 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