Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2172998rdb; Sun, 11 Feb 2024 15:23:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2dDWPtxUkurUqPFH0MEj6fkih+iFmgswK3saUTMI1IUVOm1tG9rnDqYkCvNaVwHqNvhCw X-Received: by 2002:a05:6a20:e196:b0:19e:99fd:2946 with SMTP id ks22-20020a056a20e19600b0019e99fd2946mr4181585pzb.2.1707693809902; Sun, 11 Feb 2024 15:23:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707693809; cv=pass; d=google.com; s=arc-20160816; b=wL5EDFohZzewTmiInHw6MOTBiU4qf6nonxAsrvfDE8lP0HpKA28+LIQFVDxl6FYC3H DFFVWlbGIk75nFx/k7AHSbW9LyjvS0KLuZvgAmjh+UBgPJ7FdaobzMusz66McGxMoGwz 6ZAPs2UQMAwmmZtBDeLm8kiFLbUCxo+gqgJ7tLTT2puzfKlQOpr+eal3iD13ViITf98g xbp2oB7w656zBYFDi7ScJTk++AR+UifvffQRQWYOFx1cnb+u1laJl8OGyCj6iLJymPAq +WSe/0p3FgtoDRdQ2hBUNOXZLXP09HdwxrWV4qWxJa2Jb2Jc7vcaF3LLVtYEHMwUSqt+ s0Rw== 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=Sfbf3AT5ecqOTRgskQATewI4v5udbPLAHYpKLfJn2NU=; b=kcsFSTDjW2GII/JNnuEr7nyIIAa+nuUCoBbivqEe42YEf3UJpZX7y1rqvxbOD2ls4J /KPQ2QTL5bVCEqtZc/osVPpwoCKc4RA2ZIa2kGgJu+JKjewT6qoYNOqR3G+54Y3MShlB kkbB/D/MmVFR0czFPqxtOJ/ScaUeOs3QJ+Qrf5VAQtv1D6kMOIwdw3qHG9Fu6PeiS1tj 2IKPBmABUm/k8t58i3xNBZID97sFa06MyhTrFQQG2c3o/+E3kX6kPjeBXX86nJ/e/H9z QDWIT3PGrjj743IZMRdJ8WXiJ40SO1Ig7IZcUWz1Ik0c/ajWDDVCCNn0wjReLvTDhPvM RtOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=EDcmDL1a; 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-61005-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61005-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; AJvYcCUZQJiqPwSR4rl8yHJezU0fKO9To1ETWGjeHkpSpy0gETXYmpNDvuBoJWvX21ElUzn34sNOHwwbXs6ZOZbRxXxt5InBqym2oN4tf/MCYw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z13-20020a170903018d00b001d9e18bc3cdsi5589756plg.358.2024.02.11.15.23.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 15:23:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61005-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=EDcmDL1a; 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-61005-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61005-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B9F54B22B42 for ; Sun, 11 Feb 2024 23:20:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED38339FC4; Sun, 11 Feb 2024 23:16:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="EDcmDL1a" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 5B3AA1EB3D for ; Sun, 11 Feb 2024 23:15:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707693361; cv=none; b=TANrajItEhkfbGz7TSV1pdiXZCw++8HFlgOjKN4RnEWcyUOayjHncV1RGyk60CdCWoboPttR/7xY/YgUsuPjpe3JjTfjZDvyZsbSokFwtuUz/2IdlfzvvzhgkoaG5sqvhFUlP+fszFXTHl2+mkRJOgR5dEmrFj9+MkcTt99ezVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707693361; c=relaxed/simple; bh=M+TCf4sn0Vj4ZvvDThMshhJMhSj/72BJZc8cZVfWfZY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F70j4AUtPuitoEqSwFMBmAxa0JYav98M3WmenoajG2T0k4htIh5mhszIe7TKuLRf5Uhl3GS+fULmq8AahZfNJLktxGh9SjzMSz0GDs5Ju3fUMap+nm4pSt3rXzF2piZwmol13lkO40EADDy55pI9c1+X6F+YrshJsTIl+fP+2GE= 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=EDcmDL1a; arc=none smtp.client-ip=209.85.208.45 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-f45.google.com with SMTP id 4fb4d7f45d1cf-556c3f0d6c5so3495200a12.2 for ; Sun, 11 Feb 2024 15:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1707693356; x=1708298156; 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=EDcmDL1aSaJqrTFBU+n+xdjBF+EllnK9iB4lhemKeOsi7O+EXzrnQw5MbdNgwxXwiC MNIAQ2EtGs8GO+04DVpiYdV9IhdN2WhpHJ5aykFHfd++fgwI13mt85gWqjgjTvaR9r5p Sttcku4kGfTpNNrJpYgqum/4tVJUSWRjKD99sx/khhkHj6O+0/0W4kT7SA7i2WuBjIJ1 PWqQyozwoLWbqHBJ4qMBmiFIZmEH7N51pgZe+U61ZJOXlYWhvxj88KpPJ/haUEm6jedS qcHv6lP/AUkvKXviJHJUEEeMlKNvxSOaP7xarma3QXCOD/bbtp2xHlpViqO0/HLWGazw 5/Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707693356; x=1708298156; 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=jl3JJ55YK4BwXOjGDe8l4lpmglx6UL0kRYNp4HfmC/5rm8qrVKPwq/lXEl61vIMIrr PlMKg3QtF3lTkkcwa8fZAPI+k40F1D3S4Y0JuCIYx3wE/iLH5+wIzjaP2ykpGX0yppE4 XlxQGlLYD05V08l+vqYpRDkRr8dF1sVd2sFJ8mdpU3TT69sYVgmurSSsiB3N23+U9U+v zecKEIltJDuMm5MaAlhHnKsHoyzmPIVVKTYQqRE8sAu7c0BMRF2FgTWzmKZahOpexseq V3The0ydwHqQJSz0neO9JE98YTOKV8I4gskHndUkLKHpLF2CzcSwzmMlbmjECeuAX6rG iJRg== X-Gm-Message-State: AOJu0YwD2Lco8sHT6tlxpgrX0fXL4MpoGnNXymi946xCWodfPQ6cO6Df B+f+aozioEXv8lqPU61uu8xozDKScSDBuZVY0Q5+GSkZ4nEXOkPN5ysKbRSAlBN4fSvIll+tZlr n X-Received: by 2002:a05:6402:440b:b0:561:c627:cad8 with SMTP id y11-20020a056402440b00b00561c627cad8mr34934eda.36.1707693356398; Sun, 11 Feb 2024 15:15:56 -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 et13-20020a056402378d00b0055d19c9daf2sm2170180edb.15.2024.02.11.15.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 15:15:54 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v4 24/35] list_lru.h: move declarations to list_lru_types.h Date: Mon, 12 Feb 2024 00:15:07 +0100 Message-Id: <20240211231518.349442-25-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240211231518.349442-1-max.kellermann@ionos.com> References: <20240211231518.349442-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 --- 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 */ -- 2.39.2