[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190815121104.29140-1-thunder.leizhen@huawei.com>
Date: Thu, 15 Aug 2019 20:11:02 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Jean-Philippe Brucker <jean-philippe.brucker@....com>,
"Jean-Philippe Brucker" <jean-philippe@...aro.org>,
John Garry <john.garry@...wei.com>,
"Robin Murphy" <robin.murphy@....com>,
Will Deacon <will@...nel.org>, Joerg Roedel <joro@...tes.org>,
iommu <iommu@...ts.linux-foundation.org>,
Omer Peleg <omer@...technion.ac.il>,
Adam Morrison <mad@...technion.ac.il>,
Shaohua Li <shli@...com>, Ben Serebrin <serebrin@...gle.com>,
David Woodhouse <David.Woodhouse@...el.com>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH v2 0/2] iommu/iova: enhance the rcache optimization
v1 --> v2
1. I did not chagne the patches but added this cover-letter.
2. Add a batch of reviewers base on
9257b4a206fc ("iommu/iova: introduce per-cpu caching to iova allocation")
3. I described the problem I met in patch 2, but I hope below brief description
can help people to quickly understand.
Suppose there are six rcache sizes, each size can maximum hold 10000 IOVAs.
--------------------------------------------
| 4K | 8K | 16K | 32K | 64K | 128K |
--------------------------------------------
| 10000 | 9000 | 8500 | 8600 | 9200 | 7000 |
--------------------------------------------
As the above map displayed, the whole rcache buffered too many IOVAs. Now, the
worst case can be coming, suppose we need 20000 4K IOVAs at one time. That means
10000 IOVAs can be allocated from rcache, but another 10000 IOVAs should be
allocated from RB tree base on alloc_iova() function. But the RB tree currently
have at least (9000 + 8500 + 8600 + 9200 + 7000) = 42300 nodes. The average speed
of RB tree traverse will be very slow. For my test scenario, the 4K size IOVAs are
frequently used, but others are not. So similarly, when the 20000 4K IOVAs are
continuous freed, the first 10000 IOVAs can be quickly buffered, but the other
10000 IOVAs can not.
Zhen Lei (2):
iommu/iova: introduce iova_magazine_compact_pfns()
iommu/iova: enhance the rcache optimization
drivers/iommu/iova.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++----
include/linux/iova.h | 1 +
2 files changed, 95 insertions(+), 6 deletions(-)
--
1.8.3
Powered by blists - more mailing lists