From patchwork Sun Feb 11 23:15:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 199555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2144692dyd; Sun, 11 Feb 2024 15:26:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFszg/oFD2SI5gvWAe1zzip+BBO1Q6kWGUJZNi2ERkRUmL2cvgQtVOu1qR5rpn7LaW/KSvd X-Received: by 2002:a62:b50d:0:b0:6df:e035:5549 with SMTP id y13-20020a62b50d000000b006dfe0355549mr4711177pfe.15.1707694017936; Sun, 11 Feb 2024 15:26:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707694017; cv=pass; d=google.com; s=arc-20160816; b=qbPlA/Qb8ydzJm/OvT5+xvP8X+xuIMeKZ7yC6C5WfEtoYS8bDPzeAYXx2VeY/4G/MU 4PCPd8Ik0ZSSrbRLEJOULSDZK+szfY8MwqZWhtxEk+AjTI65rsAuZ/0ClQICbpCjXIs3 oPwmmWZ4/A8AkK00j9q334llEeZGmpB5bpRa3eiZ4p6TvxuPI2oOX5s7+pmOkE0qv8fg OrAsuySEX5d0aFGQ3ne70mxznNJb4azHT1rHkUnxagloo6Nn6TlwJr4nUmNPErFmGH5v fuQaJAAAm34pvvYOdSd0uivkxHmKYuPuVyZl9HNgnme8fo8W7rVg6ki/IzlvRb+f9ySX HouQ== 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=JZgdswfuJ13SSQUzQZnez33tJFqs+eR1dv0YKO9uOQA=; b=U+IOedFx7ncfCF9zeUBHEdn10h8n5FYekNUbidrtOIJpFEn47AuilxDI3N51NfFVSy UaMHq2r4u0upzCAd5z4N+8yeDqYWsd2pu/gi3swaldCes39dKAUEOG7c1i9n7em+guXK PsHS+E0lE1OgUKnzjNOi3um1d/IKxidnxeYLBCL6uUfyN0MHEcDnCmQhTWYcDFtG+6V+ Xh6BulQbR8C9/WjQD1s8QkuWHxIzveScDaOuhaBY4JDF64zvGXu2IKDzg80Gg5hykS9r bfYKDUiFNo8XXl6r/wredEotXBopBrByKUOYwxDjAGWUDA7yFpQlv9ueGAq3Xemg5sZn rzqw==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61005-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=2; AJvYcCWJhsupRUl6/hyM8JQt+MckrI/ZKXRMelth8KRNa0EUrtxSo+lclVNKJom99YSuAdWo2sM7jvMmrfSD0aBbAr29U+YA8A== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x18-20020a63b212000000b005d818072f2esi5332838pge.874.2024.02.11.15.26.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 15:26:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61005-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61005-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id DCBE1B23963 for ; Sun, 11 Feb 2024 23:22:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2FC81E89B; Sun, 11 Feb 2024 23:16:17 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790646962599137247 X-GMAIL-MSGID: 1790646962599137247 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 */