From patchwork Sun Feb 11 12:29:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 199427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1903720dyd; Sun, 11 Feb 2024 04:37:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVYr1f95DYWrcF0tfOUZYlbmCJYS+zXZ/fWBDrPY4jwB0TLQyubJcvZAB8MyEP/vJ+c00Kf6Wlah4XlOCTZuzKcZ/vm7Q== X-Google-Smtp-Source: AGHT+IFMph7UpCeWdRY4LaQeBvHhCfMNSQA3LDgujxaoyLHXsoliep/fW+rxYWdPUuF8XLB1Dmyd X-Received: by 2002:a17:902:bf44:b0:1d7:2e86:fb2a with SMTP id u4-20020a170902bf4400b001d72e86fb2amr3794075pls.65.1707655046947; Sun, 11 Feb 2024 04:37:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707655046; cv=pass; d=google.com; s=arc-20160816; b=rWGIN6KkPvomlp1/lKB42vDqmtB1lM6V2Yahqs60Wf+DCl7fFHkTJw1GhaL/cdjgPs N8T6EB6wC8HH6skbEnERudU8SX8+UZctZoQ+JWKViowYhSbH36q7SjQf4MR2BLUlgGeT mVde1RV+/n1ev0MyUi+WcmE349RkIq5oMtfp3KpnKgd2NnCjZnUozvAMoYbUc6XRq1ET f5+V4ctTjDs6tELo/16BgTDyDFs3KbZx1paM6OZrU2JY59GMQG81DkraB9LKfEg57G1r adcapGjgRJLQHTgpzQERyyBregfu+wxlZIy/a55BDIFW3HE4WW0T/mX1dvSVliK6OmCr kMrA== 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=33wlCo9DUXvbQxRFpboMlES43uYj+ZzSbFUQMwIDJfY=; fh=EmxleobS6LMUyTjR+y9HDD5AyKqCSoV+pcpA17wkOYo=; b=HKHbcEgL/GHz9xqERhF8plSwUKgCrNNxjHwC0ZrFQljTcKTHwNjYi2mdqeqXiZBh3T GVOrtxy93dJ7ZbDnJfZx1SvOwL/caMCEtYtKtcJzDrdrVQh+wxWM+fGA0dzF7nfAWgF2 OnayinvEyMuxNUbtUivooQa6FEOJaOo8QuxO/R3IebAuvfEjApKdftd4JQRQ4X4yhIpT IOsDpa71snesezK7wYBnvxFJ2iG2FlSn+Klys5paMBmfLXUDtiIjVWHBV+z2miR/DPnB DTV5XaT3W1JA60aOjSpe6el2p3uuM4mKrEf9ZVmM5u9PNBX9TQnUsdr7dL2aj0nCHphU WZmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=UUrRu1eJ; 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-60752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60752-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCWUHYylucRdA+Ghg/MPp9l0Wa7hJo15+3KP8qB4y8tkbGYursuV9HXxKq5KBRi+DojbTb9YobgVorFG5LLSfhKtM7BaLg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ix13-20020a170902f80d00b001d95934ad7asi4629565plb.624.2024.02.11.04.37.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 04:37:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=UUrRu1eJ; 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-60752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60752-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B15F42827C2 for ; Sun, 11 Feb 2024 12:37:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2ECCF60899; Sun, 11 Feb 2024 12:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="UUrRu1eJ" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 DEFE65F46B for ; Sun, 11 Feb 2024 12:30:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707654643; cv=none; b=nfjCRzlly6na55vw+FAddoUdPgfsKKOjqNWVfxLiXUhQpEHkVSP48FjqAQuEzh4jPnHrDdDDxgArfyxtGRt+5DEsFl+WIO/GvfEliYdG5K3S06ZnlT6TxfDQZjx14qK+flivoK3P0OC9I5bLC3OecMs0Nb55eP7OV6mU36lq03w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707654643; c=relaxed/simple; bh=M+TCf4sn0Vj4ZvvDThMshhJMhSj/72BJZc8cZVfWfZY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PeczU1LP+WanoZSEcJ+v/x4KNcqr/d2OqqqhJ05Koau15/ykOEd7nBTSOVzHIYWIgBvegsMzg49Sg88r3yelgRHE8Mj+j9go6+Tn/gTPj7o6gOzy5UDEeYPUmpI3bH+2YhUp1jWarOyKlIZMkuhCMGUGFUMJr17ZO0YIP4L4xP8= 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=UUrRu1eJ; arc=none smtp.client-ip=209.85.208.46 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-f46.google.com with SMTP id 4fb4d7f45d1cf-56001b47285so3090104a12.1 for ; Sun, 11 Feb 2024 04:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1707654638; x=1708259438; 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=33wlCo9DUXvbQxRFpboMlES43uYj+ZzSbFUQMwIDJfY=; b=UUrRu1eJcrf6c60uR2/5LPXvE7QQTN0E7utX5olfoM9ZvNOIxusRa6yCufNX2XTvOT cJ7VJD9080wo8fIuec/x5qxQuYmVX/De9KFstCg09+XEA3GNDOftd3FNUNljRaeI/GVf Yez3g6L28a3oGcwhrfhFSdX2bd1nfZf96hc8TVQ9HUlOZZ81CBXb/FcP5RjnHorVW0FD mdFnJoUWGPLoXbUxI2fKHMhkoA8u8++hXbGrPz93IKq/orfa625hHZc92OZQS80XmA32 /eorzccEJEslXA1sdEHIJgfkU/bKStkG47Mezqd+mElwlR5qIkwalWv1vSZjnLDTzTLT v0ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707654638; x=1708259438; 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=33wlCo9DUXvbQxRFpboMlES43uYj+ZzSbFUQMwIDJfY=; b=AxN/FvrUltN7yKeP9SkE7PhIfihh1lguh/2bZIro4XMLE5zUOzHJ0YUUmVZCcol86n C7cuqo9lSRezP0iZtdqxvkNW0+PZtQUHBt+cDrC1uZaQo7iQZjYjABGFYpg1eXlO+4iW g4TVyaAC7Ibwzalqq/M/UPRJXPvc3zNn1IL6OdY9e6dtVEHYhqrJbv3EvKMX4HyVcvS6 kPoXIyIHgi2vUBoK/D+qkhSJ4W5zwO2dk0nUIseSYecmuAVwRGEh5Y+stgGwSPP/mj1H 8hPbRBi5U1BBapp9z+rND26GEwtdBUxSlYw6f5xUliUpAgH70VK5RIgxWbQUjHpOo9jd Y8OQ== X-Gm-Message-State: AOJu0YzJmQAMJAlOX6gECDtzr+4I95H93DF2IvskakNR4OHEFx5vBYhl LtTe3+2t+Lp8IQk2SGSCbddrZCcXXVNvnPNhR+2cRnOCAgXqTzWE7AZeZXg6lTiZq06cxLgCZYZ g X-Received: by 2002:a05:6402:30b1:b0:561:9968:a1ec with SMTP id df17-20020a05640230b100b005619968a1ecmr841785edb.9.1707654638397; Sun, 11 Feb 2024 04:30:38 -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 fj18-20020a0564022b9200b0056187ca4120sm1024611edb.10.2024.02.11.04.30.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 04:30:37 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v3 24/35] list_lru.h: move declarations to list_lru_types.h Date: Sun, 11 Feb 2024 13:29:49 +0100 Message-Id: <20240211123000.3359365-25-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240211123000.3359365-1-max.kellermann@ionos.com> References: <20240211123000.3359365-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: 1790606098316162040 X-GMAIL-MSGID: 1790606098316162040 By providing declarations in a lean header, we can reduce header dependencies. Signed-off-by: Max Kellermann --- fs/super.c | 1 + include/linux/fs.h | 2 +- include/linux/list_lru.h | 36 +---------------------------- include/linux/list_lru_types.h | 42 ++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 36 deletions(-) create mode 100644 include/linux/list_lru_types.h diff --git a/fs/super.c b/fs/super.c index 2ab97cc49374..6a8cc1c49940 100644 --- a/fs/super.c +++ b/fs/super.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/include/linux/fs.h b/include/linux/fs.h index 5862fe2c82d5..1cfe76f7544e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h index 5e8cd106dae4..bb348492037f 100644 --- a/include/linux/list_lru.h +++ b/include/linux/list_lru.h @@ -8,14 +8,10 @@ #ifndef _LRU_LIST_H #define _LRU_LIST_H -#include +#include #include #include -#ifdef CONFIG_MEMCG_KMEM -#include -#endif - struct mem_cgroup; /* list_lru_walk_cb has to always return one of those */ @@ -31,36 +27,6 @@ enum lru_status { internally, but has to return locked. */ }; -struct list_lru_one { - struct list_head list; - /* may become negative during memcg reparenting */ - long nr_items; -}; - -struct list_lru_memcg { - struct rcu_head rcu; - /* array of per cgroup per node lists, indexed by node id */ - struct list_lru_one node[]; -}; - -struct list_lru_node { - /* protects all lists on the node, including per cgroup */ - spinlock_t lock; - /* global list, used for the root cgroup in cgroup aware lrus */ - struct list_lru_one lru; - long nr_items; -} ____cacheline_aligned_in_smp; - -struct list_lru { - struct list_lru_node *node; -#ifdef CONFIG_MEMCG_KMEM - struct list_head list; - int shrinker_id; - bool memcg_aware; - struct xarray xa; -#endif -}; - void list_lru_destroy(struct list_lru *lru); int __list_lru_init(struct list_lru *lru, bool memcg_aware, struct lock_class_key *key, struct shrinker *shrinker); diff --git a/include/linux/list_lru_types.h b/include/linux/list_lru_types.h new file mode 100644 index 000000000000..51ccef0d6994 --- /dev/null +++ b/include/linux/list_lru_types.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LRU_LIST_TYPES_H +#define _LRU_LIST_TYPES_H + +#include + +#ifdef CONFIG_MEMCG_KMEM +#include // for bool +#include +#endif + +struct list_lru_one { + struct list_head list; + /* may become negative during memcg reparenting */ + long nr_items; +}; + +struct list_lru_memcg { + struct rcu_head rcu; + /* array of per cgroup per node lists, indexed by node id */ + struct list_lru_one node[]; +}; + +struct list_lru_node { + /* protects all lists on the node, including per cgroup */ + spinlock_t lock; + /* global list, used for the root cgroup in cgroup aware lrus */ + struct list_lru_one lru; + long nr_items; +} ____cacheline_aligned_in_smp; + +struct list_lru { + struct list_lru_node *node; +#ifdef CONFIG_MEMCG_KMEM + struct list_head list; + int shrinker_id; + bool memcg_aware; + struct xarray xa; +#endif +}; + +#endif /* _LRU_LIST_TYPES_H */