Message ID | 20231226200205.562565-11-pasha.tatashin@soleen.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-11674-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp1073499dyb; Tue, 26 Dec 2023 12:06:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFKZiBE7bzIo3pcZmTyNAtCitVNG+IFEuxQz4e5GTLvmq9NZRxTfSDRAfsOfRYsZ2vzUmh+ X-Received: by 2002:a05:6214:12c9:b0:67f:9341:76c1 with SMTP id s9-20020a05621412c900b0067f934176c1mr8910288qvv.118.1703621217313; Tue, 26 Dec 2023 12:06:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703621217; cv=none; d=google.com; s=arc-20160816; b=iNNToGYJcLKsnleFvnQGGyROZ226ga/ydUKVoYrGS/Cbr1pgt9GrNqZR0r5oZjm67L AVfpNfSJS2WXfH/bYp8ut/jtfqt9bxtNedXw2QjeZapRaQnJEJjdqghfRrpM2Qr0MfsA 1xvkwjdr82+N9R+26MWs8wqmSrfCAKxEQwA4864f9OnKepKRSVOv4Uz7k5XSs2Bw7/+5 3MtW3V0BGT8XogpXyQsy75GDPcj2ZgUDLeu+QegAH8uSwUtfbv6qoKVYLEhvcm8D2ZNj UuHl1ZjaNCdke5uiHsfNq6uwE2s8ms8tldNi86vQASdmF6pFEeaGYJa/WThV/U/HQaOV k4dQ== ARC-Message-Signature: i=1; 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:to:from:dkim-signature; bh=BtxKf3FqZi0ydpudkf0bXoEdqlC2cPc9JiSI0VbRHzc=; fh=lUkiT048LCyG2kYH3uS9GPNyu6fkGQdYtFXGdyQ4NZk=; b=tIcRSoj3UUvTeUOY9O4szcTjt/ajmBNu3hI/C2saoVewG4TFjsXALiXSuF3uv952tj OsGHvhT5yygl1OOd+SDc2ZsjKmD+Rmq8QzhgMmfBWcQmNr70rFoqBQ1X9ghrn+/NRQ/i ngaX3dPTPHyG+WymuTIkMGF5eJ9QHWPlMfDwOLtzs++91CmZG1m3vXIbIA8u3mMw1OLS b4/fPtj0Lz8JobFKWG0sVN4WPHJjzTqUIXxoZaDY/t4dY0NBsrSXYxMEQiaEb2BUB/2u 58m1dzrDZzwQzsPAHED1Va/iu/RcNZYMkIcPgDYGuFtgdeGifr6HyiJPG+GrYWSgzAyh tkCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=fLxzjMjZ; spf=pass (google.com: domain of linux-kernel+bounces-11674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11674-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y7-20020a0ceac7000000b0067f7e8b1e60si13174861qvp.311.2023.12.26.12.06.57 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 12:06:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=fLxzjMjZ; spf=pass (google.com: domain of linux-kernel+bounces-11674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11674-ouuuleilei=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 12D241C22058 for <ouuuleilei@gmail.com>; Tue, 26 Dec 2023 20:06:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71136199CF; Tue, 26 Dec 2023 20:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="fLxzjMjZ" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 7784E125A4 for <linux-kernel@vger.kernel.org>; Tue, 26 Dec 2023 20:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-781045f1d23so451250385a.1 for <linux-kernel@vger.kernel.org>; Tue, 26 Dec 2023 12:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1703620937; x=1704225737; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BtxKf3FqZi0ydpudkf0bXoEdqlC2cPc9JiSI0VbRHzc=; b=fLxzjMjZ3/6dZYApf1ia3Jhf82a3OiMW/a+ahz6Xz62kehsdgHIGgC+cyMVAqq0UCA +vYFAm5WwArj/olKPcIuFmYIcVmvY2ZjbOKgaWnD8veSHpWE8qmahh14KxHfhsrWsKVN BAh/Pla/3UJXzAkVQgJGzdO465M5D3yKn6BaZFzFUsWIgCJniBKvv/PRa4wWTRe09KmX EvJEZ5dGienG3L0q1slgkC3rTHDlK2NyQXZ0WOS9S++oenlpScohOK+Uck9e6z8k+mnL 7AuyV3TjJz1dYv5v/5gcSFOywEd9QxKpvmAHMDalps0LCoEMxRkrdtxB/kQMm3jrNkZi VC4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703620937; x=1704225737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BtxKf3FqZi0ydpudkf0bXoEdqlC2cPc9JiSI0VbRHzc=; b=P0OnQ1WWfPW3ol8q50exagnomUNMD2nGSoXBPfeDs1IgJHeWtrS9rpYL/ByXY5AVzB rosu1qu5gaVt4y9Mj1t5pDoU0qe5cqgsfLKIwuaDrAUuSUnWds3b3YPItDebbPsWOHnQ v61OajqDEo4+PjWXPD/I+dxG4jK6w08sS6taagps1mKb+8s+nbADxZ4fteEmFHRNcaNt 6o9wwXgX7s9ik3D4ZL7YxCx950locvYvQ5OpmktxVVzlcJcnH5aj0uebzRl9hzoeJM6c 2kttz4sWWoUtv1pkre4KL9QiAtvEm2eC++TDBSsPw4XO8XBbzV95Xj0OONPi/SadQTdj tKUg== X-Gm-Message-State: AOJu0YxgGXGHCFGzUiOzaHifxvo7GCXsvWdqOppOuGkIZOn0caHcPivJ VRuWn8UoX1M8pQ1CImg1gL0s06nRYMfEEA== X-Received: by 2002:a0c:e90e:0:b0:67f:d69e:9c45 with SMTP id a14-20020a0ce90e000000b0067fd69e9c45mr6794763qvo.11.1703620937325; Tue, 26 Dec 2023 12:02:17 -0800 (PST) Received: from soleen.c.googlers.com.com (55.87.194.35.bc.googleusercontent.com. [35.194.87.55]) by smtp.gmail.com with ESMTPSA id t5-20020a0cf985000000b0067f696f412esm4894539qvn.112.2023.12.26.12.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 12:02:17 -0800 (PST) From: Pasha Tatashin <pasha.tatashin@soleen.com> To: akpm@linux-foundation.org, alim.akhtar@samsung.com, alyssa@rosenzweig.io, asahi@lists.linux.dev, baolu.lu@linux.intel.com, bhelgaas@google.com, cgroups@vger.kernel.org, corbet@lwn.net, david@redhat.com, dwmw2@infradead.org, hannes@cmpxchg.org, heiko@sntech.de, iommu@lists.linux.dev, jernej.skrabec@gmail.com, jonathanh@nvidia.com, joro@8bytes.org, krzysztof.kozlowski@linaro.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, lizefan.x@bytedance.com, marcan@marcan.st, mhiramat@kernel.org, m.szyprowski@samsung.com, pasha.tatashin@soleen.com, paulmck@kernel.org, rdunlap@infradead.org, robin.murphy@arm.com, samuel@sholland.org, suravee.suthikulpanit@amd.com, sven@svenpeter.dev, thierry.reding@gmail.com, tj@kernel.org, tomas.mudrunka@gmail.com, vdumpa@nvidia.com, wens@csie.org, will@kernel.org, yu-cheng.yu@intel.com, rientjes@google.com Subject: [PATCH v3 10/10] iommu: account IOMMU allocated memory Date: Tue, 26 Dec 2023 20:02:05 +0000 Message-ID: <20231226200205.562565-11-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20231226200205.562565-1-pasha.tatashin@soleen.com> References: <20231226200205.562565-1-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786376321902905779 X-GMAIL-MSGID: 1786376321902905779 |
Series |
IOMMU memory observability
|
|
Commit Message
Pasha Tatashin
Dec. 26, 2023, 8:02 p.m. UTC
In order to be able to limit the amount of memory that is allocated
by IOMMU subsystem, the memory must be accounted.
Account IOMMU as part of the secondary pagetables as it was discussed
at LPC.
The value of SecPageTables now contains mmeory allocation by IOMMU
and KVM.
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
---
Documentation/admin-guide/cgroup-v2.rst | 2 +-
Documentation/filesystems/proc.rst | 4 ++--
drivers/iommu/iommu-pages.h | 2 ++
include/linux/mmzone.h | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
Comments
On Tue, 26 Dec 2023, Pasha Tatashin wrote: > In order to be able to limit the amount of memory that is allocated > by IOMMU subsystem, the memory must be accounted. > > Account IOMMU as part of the secondary pagetables as it was discussed > at LPC. > > The value of SecPageTables now contains mmeory allocation by IOMMU > and KVM. > > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> Acked-by: David Rientjes <rientjes@google.com>
Hi Pasha, On Tue, Dec 26, 2023 at 08:02:05PM +0000, Pasha Tatashin wrote: > In order to be able to limit the amount of memory that is allocated > by IOMMU subsystem, the memory must be accounted. > > Account IOMMU as part of the secondary pagetables as it was discussed > at LPC. > > The value of SecPageTables now contains mmeory allocation by IOMMU > and KVM. > > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> > --- > Documentation/admin-guide/cgroup-v2.rst | 2 +- > Documentation/filesystems/proc.rst | 4 ++-- > drivers/iommu/iommu-pages.h | 2 ++ > include/linux/mmzone.h | 2 +- > 4 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst > index 3f85254f3cef..e004e05a7cde 100644 > --- a/Documentation/admin-guide/cgroup-v2.rst > +++ b/Documentation/admin-guide/cgroup-v2.rst > @@ -1418,7 +1418,7 @@ PAGE_SIZE multiple when read back. > sec_pagetables > Amount of memory allocated for secondary page tables, > this currently includes KVM mmu allocations on x86 > - and arm64. > + and arm64 and IOMMU page tables. > > percpu (npn) > Amount of memory used for storing per-cpu kernel > diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst > index 49ef12df631b..86f137a9b66b 100644 > --- a/Documentation/filesystems/proc.rst > +++ b/Documentation/filesystems/proc.rst > @@ -1110,8 +1110,8 @@ KernelStack > PageTables > Memory consumed by userspace page tables > SecPageTables > - Memory consumed by secondary page tables, this currently > - currently includes KVM mmu allocations on x86 and arm64. > + Memory consumed by secondary page tables, this currently includes > + KVM mmu and IOMMU allocations on x86 and arm64. While I can see the value in this for IOMMU mappings managed by VFIO, doesn't this end up conflating that with the normal case of DMA domains? For systems that e.g. rely on an IOMMU for functional host DMA, it seems wrong to subject that to accounting constraints. Will
On Tue, Feb 13, 2024 at 10:44:53AM -0500, Pasha Tatashin wrote: > > > SecPageTables > > > - Memory consumed by secondary page tables, this currently > > > - currently includes KVM mmu allocations on x86 and arm64. > > > + Memory consumed by secondary page tables, this currently includes > > > + KVM mmu and IOMMU allocations on x86 and arm64. > > Hi Will, > > > While I can see the value in this for IOMMU mappings managed by VFIO, > > doesn't this end up conflating that with the normal case of DMA domains? > > For systems that e.g. rely on an IOMMU for functional host DMA, it seems > > wrong to subject that to accounting constraints. > > The accounting constraints are only applicable when GFP_KERNEL_ACCOUNT > is passed to the iommu mapping functions. We do that from the vfio, > iommufd, and vhost. Without this flag, the memory useage is reported > in /proc/meminfo as part of SecPageTables field, but not constrained > in cgroup. Thanks, Pasha, that explanation makes sense. I still find it bizarre to include IOMMU allocations from the DMA API in SecPageTables though, and I worry that it will confuse people who are using that metric as a way to get a feeling for how much memory is being used by KVM's secondary page-tables. As an extreme example, having a non-zero SecPageTables count without KVM even compiled in is pretty bizarre. Will
On Fri, Feb 16, 2024 at 02:48:00PM -0500, Pasha Tatashin wrote: > On Fri, Feb 16, 2024 at 12:58 PM Will Deacon <will@kernel.org> wrote: > > > > On Tue, Feb 13, 2024 at 10:44:53AM -0500, Pasha Tatashin wrote: > > > > > SecPageTables > > > > > - Memory consumed by secondary page tables, this currently > > > > > - currently includes KVM mmu allocations on x86 and arm64. > > > > > + Memory consumed by secondary page tables, this currently includes > > > > > + KVM mmu and IOMMU allocations on x86 and arm64. > > > > > > Hi Will, > > > > > > > While I can see the value in this for IOMMU mappings managed by VFIO, > > > > doesn't this end up conflating that with the normal case of DMA domains? > > > > For systems that e.g. rely on an IOMMU for functional host DMA, it seems > > > > wrong to subject that to accounting constraints. > > > > > > The accounting constraints are only applicable when GFP_KERNEL_ACCOUNT > > > is passed to the iommu mapping functions. We do that from the vfio, > > > iommufd, and vhost. Without this flag, the memory useage is reported > > > in /proc/meminfo as part of SecPageTables field, but not constrained > > > in cgroup. > > > > Thanks, Pasha, that explanation makes sense. I still find it bizarre to > > include IOMMU allocations from the DMA API in SecPageTables though, and > > I worry that it will confuse people who are using that metric as a way > > to get a feeling for how much memory is being used by KVM's secondary > > page-tables. As an extreme example, having a non-zero SecPageTables count > > without KVM even compiled in is pretty bizarre. > > I agree; I also prefer a new field in /proc/meminfo named > 'IOMMUPageTables'. This is what I proposed at LPC, but I was asked to > reuse the existing 'SecPageTables' field instead. The rationale was > that 'secondary' implies not only KVM page tables, but any other > non-regular page tables. > > I would appreciate the opinion of IOMMU maintainers on this: is it > preferable to bundle the information with 'SecPageTables' or maintain > a separate field? I personally find it confusing to add all IOMMU page-table allocations to SecPageTables, considering that userspace could be using that today with a reasonable expectation that it's concerned only with virtual machine overhead. However, if the opposite conclusion was reached at LPC, then I really don't want to re-open the discussion and derail your patchset. Will
On Fri, Feb 16, 2024 at 02:48:00PM -0500, Pasha Tatashin wrote: > On Fri, Feb 16, 2024 at 12:58 PM Will Deacon <will@kernel.org> wrote: > > > > On Tue, Feb 13, 2024 at 10:44:53AM -0500, Pasha Tatashin wrote: > > > > > SecPageTables > > > > > - Memory consumed by secondary page tables, this currently > > > > > - currently includes KVM mmu allocations on x86 and arm64. > > > > > + Memory consumed by secondary page tables, this currently includes > > > > > + KVM mmu and IOMMU allocations on x86 and arm64. > > > > > > Hi Will, > > > > > > > While I can see the value in this for IOMMU mappings managed by VFIO, > > > > doesn't this end up conflating that with the normal case of DMA domains? > > > > For systems that e.g. rely on an IOMMU for functional host DMA, it seems > > > > wrong to subject that to accounting constraints. > > > > > > The accounting constraints are only applicable when GFP_KERNEL_ACCOUNT > > > is passed to the iommu mapping functions. We do that from the vfio, > > > iommufd, and vhost. Without this flag, the memory useage is reported > > > in /proc/meminfo as part of SecPageTables field, but not constrained > > > in cgroup. > > > > Thanks, Pasha, that explanation makes sense. I still find it bizarre to > > include IOMMU allocations from the DMA API in SecPageTables though, and > > I worry that it will confuse people who are using that metric as a way > > to get a feeling for how much memory is being used by KVM's secondary > > page-tables. As an extreme example, having a non-zero SecPageTables count > > without KVM even compiled in is pretty bizarre. > > I agree; I also prefer a new field in /proc/meminfo named > 'IOMMUPageTables'. This is what I proposed at LPC, but I was asked to > reuse the existing 'SecPageTables' field instead. The rationale was > that 'secondary' implies not only KVM page tables, but any other > non-regular page tables. Right, SeanC mentioned that the purpose of SecPageTables was to capture all non-mm page table radix allocations. > I would appreciate the opinion of IOMMU maintainers on this: is it > preferable to bundle the information with 'SecPageTables' or maintain > a separate field? I think you should keep them together. I don't think we should be introducing new counters, in general. Detailed memory profile should come from some kind of more dynamic and universal scheme. Hopefully that other giant thread about profiling will reach some conclusion. Jason
> > > > > While I can see the value in this for IOMMU mappings managed by VFIO, > > > > > doesn't this end up conflating that with the normal case of DMA domains? > > > > > For systems that e.g. rely on an IOMMU for functional host DMA, it seems > > > > > wrong to subject that to accounting constraints. > > > > > > > > The accounting constraints are only applicable when GFP_KERNEL_ACCOUNT > > > > is passed to the iommu mapping functions. We do that from the vfio, > > > > iommufd, and vhost. Without this flag, the memory useage is reported > > > > in /proc/meminfo as part of SecPageTables field, but not constrained > > > > in cgroup. > > > > > > Thanks, Pasha, that explanation makes sense. I still find it bizarre to > > > include IOMMU allocations from the DMA API in SecPageTables though, and > > > I worry that it will confuse people who are using that metric as a way > > > to get a feeling for how much memory is being used by KVM's secondary > > > page-tables. As an extreme example, having a non-zero SecPageTables count > > > without KVM even compiled in is pretty bizarre. > > > > I agree; I also prefer a new field in /proc/meminfo named > > 'IOMMUPageTables'. This is what I proposed at LPC, but I was asked to > > reuse the existing 'SecPageTables' field instead. The rationale was > > that 'secondary' implies not only KVM page tables, but any other > > non-regular page tables. > > Right, SeanC mentioned that the purpose of SecPageTables was to > capture all non-mm page table radix allocations. > > > I would appreciate the opinion of IOMMU maintainers on this: is it > > preferable to bundle the information with 'SecPageTables' or maintain > > a separate field? > > I think you should keep them together. I don't think we should be > introducing new counters, in general. Thanks Jason, I will keep it as-is. I will send a new version soon with your comments addressed. > Detailed memory profile should come from some kind of more dynamic and > universal scheme. Hopefully that other giant thread about profiling > will reach some conclusion. +1! Memory profiling is going to be a very useful addition to the kernel. Pasha
diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index 3f85254f3cef..e004e05a7cde 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -1418,7 +1418,7 @@ PAGE_SIZE multiple when read back. sec_pagetables Amount of memory allocated for secondary page tables, this currently includes KVM mmu allocations on x86 - and arm64. + and arm64 and IOMMU page tables. percpu (npn) Amount of memory used for storing per-cpu kernel diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index 49ef12df631b..86f137a9b66b 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -1110,8 +1110,8 @@ KernelStack PageTables Memory consumed by userspace page tables SecPageTables - Memory consumed by secondary page tables, this currently - currently includes KVM mmu allocations on x86 and arm64. + Memory consumed by secondary page tables, this currently includes + KVM mmu and IOMMU allocations on x86 and arm64. NFS_Unstable Always zero. Previous counted pages which had been written to the server, but has not been committed to stable storage. diff --git a/drivers/iommu/iommu-pages.h b/drivers/iommu/iommu-pages.h index 4e70cdf7acac..b4289d577e2c 100644 --- a/drivers/iommu/iommu-pages.h +++ b/drivers/iommu/iommu-pages.h @@ -27,6 +27,7 @@ static inline void __iommu_alloc_account(struct page *page, int order) const long pgcnt = 1l << order; mod_node_page_state(page_pgdat(page), NR_IOMMU_PAGES, pgcnt); + mod_lruvec_page_state(page, NR_SECONDARY_PAGETABLE, pgcnt); } /** @@ -39,6 +40,7 @@ static inline void __iommu_free_account(struct page *page, int order) const long pgcnt = 1l << order; mod_node_page_state(page_pgdat(page), NR_IOMMU_PAGES, -pgcnt); + mod_lruvec_page_state(page, NR_SECONDARY_PAGETABLE, -pgcnt); } /** diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index f0b54c752e22..da68f9977206 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -199,7 +199,7 @@ enum node_stat_item { NR_KERNEL_SCS_KB, /* measured in KiB */ #endif NR_PAGETABLE, /* used for pagetables */ - NR_SECONDARY_PAGETABLE, /* secondary pagetables, e.g. KVM pagetables */ + NR_SECONDARY_PAGETABLE, /* secondary pagetables, KVM & IOMMU */ #ifdef CONFIG_IOMMU_SUPPORT NR_IOMMU_PAGES, /* # of pages allocated by IOMMU */ #endif