From patchwork Wed Jan 31 14:49:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 194792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1945056dyb; Wed, 31 Jan 2024 07:01:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQLZcS3zLl/ce2uxYMESVt3ilxEuo1RN259h+MIstKtSGGQOcPB863FXTBNekrvS6LCNGl X-Received: by 2002:a17:907:170b:b0:a35:fa06:aced with SMTP id le11-20020a170907170b00b00a35fa06acedmr1301229ejc.65.1706713282329; Wed, 31 Jan 2024 07:01:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706713282; cv=pass; d=google.com; s=arc-20160816; b=TORPStzNPWhuVVM8qzSL2P74pZY8CZJAdrKORP4qbhZSoQ09n8g0ZhHmY3+Nkzfyv1 VoAMHzdgFBsMWPyAF6MzrImFNxvXDNbbOsRXCw+f7OFfbl3XTxqMbtMn3/TyY4EpP7uG 4eCZM0ytPhLVO5KthPQ3aX4Mk/Cy8Ekz6G8athUPQEDO8LsAKzyWbknK08gL59If/WyQ 3QV1kkHqceZ70AcM080+umWYKSSvY+3YGclIV9dfv6fQsVMYN+VCOaLbOOQuLdXRTsc7 wV7pI/a0AppdCfXl0t7T5vMlQ81FtlLw6cBKVs/8JFTW/kFvS5ae2eoj+7RmA+fdmmhO uJ0w== 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=ML11U0aRq2SFVG0rLTJngEYXYfv9M/na78EUBHM5izI=; fh=tRALfoF5xlSLMH+mxkmKoUc/k4tgvaxzOE6CQNmi3s4=; b=WJLz/I02blgg+pYaUOgljUUJ3Xk8D3OLJ7Iq4rC7USQFfAh83zu0yDTJz4wjuEvl0W 7xfX573cp+uvwEi88SaAydDACKuH6uDdx/sJOZ49BRJa8BRstg5v0Y11axPiqEL/Zfz0 VerKbz9TwNfdUd05ig6JLHsmXIZa1hCqIV7T83lkBBfvfrK4DKqQ5g9ltHgbldk2g4Tt LvaZP2H6/LK5HA7J8qxthKDThrlHGtQFmg1rstxPE1EGZjGBwTfIkAmZnNb4DNKI2kuw QgANR6Ok9XT/Kw6MVorLdIyaBDwCcUgXJ8Hb+Kds+DYGKdAXiKzjrwEGArkAOXXhljK7 HVvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=YqeQ6LpU; 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-46643-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46643-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=1; AJvYcCWTfrmyEOzp754aevQvGSOctaFsws7RiiqY2meM891wq9g4FbFoJnUizz9qvPzDYmsROayisk760O2MNov5bgfUL6pMZg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p17-20020a1709060e9100b00a3667fe8440si835877ejf.230.2024.01.31.07.01.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 07:01:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46643-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=YqeQ6LpU; 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-46643-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46643-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 8E4D81F2ABDB for ; Wed, 31 Jan 2024 14:54:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A00B12F5B0; Wed, 31 Jan 2024 14:50:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="YqeQ6LpU" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 8181A12A14D for ; Wed, 31 Jan 2024 14:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712630; cv=none; b=XVGEeDZE3ouCK4/GwQgtO/q7UBt1YwBMtMc+J6HkarotzixgfS/YF2lhTHA1jeQTo/4hXrWXeSs5jAYFWkVtqwbSusEvbgLrbwiiGAqdWhV4dD3zGxrQ48d3VdWPrKUFHzsBpegTbf3e1uqdj0d7+6czufkmNGJnU4WAAjpUHpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712630; c=relaxed/simple; bh=J2VH8/i/2DpwZazCrLvqYT71vTgotFPFK0JZfWd79MQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MxZJpxAtGD02yQF5TgiYOAw6fPhQMjY+lgd+RsJGXn4qpP3h27c5fXaZvbnxoh43D5eIsaV1iV00pHcdn5AYwlRcJWlBmbcDHu8hWB+PvsswZw7YahmS8OCELKXauI/bY8k8tNv4cjRt+zgbbePaN2Fl5XWY9LbOc35aIzyL0U4= 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=YqeQ6LpU; arc=none smtp.client-ip=209.85.128.43 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-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40faff092a2so12207095e9.2 for ; Wed, 31 Jan 2024 06:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1706712624; x=1707317424; 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=ML11U0aRq2SFVG0rLTJngEYXYfv9M/na78EUBHM5izI=; b=YqeQ6LpUU2tQYvR/hkJ3OJygOncOVHHTlySwWDBh+I7TDiJN+aiGwcI6RkkdTXb8Wy l+N0vTkivk7zNLYELeXWUiK7qECqQjYweBeVsaoPTSnQDTlZpLUomn5IqtBiT1q3d0Jk vL6AV1Oj34OqP7i+FyQDGRlcP+Oe7jcf1SnEOrRPzpVkWXPffyRPDFo9TVnsAX810MHn bx3dq7A6xqi15krADhqxvX2wwPMw4tmO3bNiLlhbbQVQjrA+QYMd83er/NkA+JCE5TC/ VAs+vtfWWUbBkWssojz8PwVYF0kHojX/8vCewBMrbI1FRBziR2mC8RzSClQnCxFwjfNz tB6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706712624; x=1707317424; 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=ML11U0aRq2SFVG0rLTJngEYXYfv9M/na78EUBHM5izI=; b=Q1TBsRFz8Yz/6JM6f8u/9oZJrrgVRq8TR0W7ApVJdgtaKOPQd0bInJPcbH0tI2xgFM FKO2EQz8Fq+cg+QquODpF/cXZbryMEFkB3kURfH84OnfBhgGC2v89WTuluqQYRYeH5w8 2INUwnqVQjwcoo6uTfeLMAAwJUuQkYsvGzSNu8nRRwE5uvrDVgQZzh+k1kEV9Ko5n4JL sGWoonfLtA1aPzp76UqygRn9ueJ/WeM7di8LgOBuFbwktLNqQNN+c0+3u0If92azbtRY IVXYYVPaV7MIDK9vUc9M1fTyyKFbYQmRqc80O9W+NHuZ1sPPCmmicJC9iLszjUYPGc3z O33w== X-Gm-Message-State: AOJu0YxJiV9rrJnU6X7nR3V9+UHNz0i+60So+vQ+zVuQuh3k7AJOiQcC vq5RdFbNV+R3kqaBPKS8lajKwCuLbnrhQsFAIbzjHyzqEDC5Px+OM4g+DS5TCE62luPCQa5NgYc K X-Received: by 2002:a5d:4d11:0:b0:33a:eb98:6aaf with SMTP id z17-20020a5d4d11000000b0033aeb986aafmr1411088wrt.12.1706712624622; Wed, 31 Jan 2024 06:50:24 -0800 (PST) Received: from raven.blarg.de (p200300dc6f2f5c00023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f2f:5c00:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id ch15-20020a5d5d0f000000b0033905a60689sm13850173wrb.45.2024.01.31.06.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:50:24 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH 11/28] percpu_counter.h: move declarations to percpu_counter_types.h Date: Wed, 31 Jan 2024 15:49:51 +0100 Message-Id: <20240131145008.1345531-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131145008.1345531-1-max.kellermann@ionos.com> References: <20240131145008.1345531-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: 1789618586693395345 X-GMAIL-MSGID: 1789618586693395345 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 88bbb724080f..80d5a1762cca 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -17,7 +17,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