mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhang Zekun <zhangzekun11@huawei.com>
To: <robin.murphy@arm.com>, <joro@8bytes.org>, <will@kernel.org>,
	<iommu@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Cc: <guohanjun@huawei.com>, <xuqiang36@huawei.com>,
	<chenweilong@huawei.com>, <thunder.leizhen@huawei.com>,
	<zhangzekun11@huawei.com>
Subject: [PATCH -next 0/2] iommu/iova: optimize the iova rcache
Date: Tue, 11 Jul 2023 10:54:50 +0800	[thread overview]
Message-ID: <20230711025452.35475-1-zhangzekun11@huawei.com> (raw)

The struct of iova rcache has diffcult in dealing with machine with
lots of cpus, because every cpu has a cpu_rcache and they need to
exchange iova in a fixed length buffer rcache->depot, this buffer
can sometimes become a bottle neck of allocating iova from iova_rcache.
The number of iova_cpu_rcache can grow with the number of cpus in
iova_rcache, but the size of rcache->depot will not. The deeper of
rcache->depot can help iova_rcache cache more iovas, and can help
iova_rcache better dealing with senarios in which drivers allocating
and free iovas on different cpu cores. We only let the size of rcache->depot
to grow with the number of cpus which is larger than 32 to avoid potential
performance decrease on machines which don't have much cpus.

Also, it is unsafe to directly free cpu rcache magazines in free_iova_rcaches,
add check before freeing it.

Zhang Zekun (2):
  iommu/iova: Add check for cpu_rcache in free_iova_rcaches
  iommu/iova: allocate iova_rcache->depot dynamicly

 drivers/iommu/iova.c | 36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

-- 
2.17.1


             reply	other threads:[~2023-07-11  3:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11  2:54 Zhang Zekun [this message]
2023-07-11  2:54 ` [PATCH -next 1/2] iommu/iova: Add check for cpu_rcache in free_iova_rcaches Zhang Zekun
2023-07-11  2:54 ` [PATCH -next 2/2] iommu/iova: allocate iova_rcache->depot dynamicly Zhang Zekun
2023-07-21  1:52 ` [PATCH -next 0/2] iommu/iova: optimize the iova rcache zhangzekun (A)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230711025452.35475-1-zhangzekun11@huawei.com \
    --to=zhangzekun11@huawei.com \
    --cc=chenweilong@huawei.com \
    --cc=guohanjun@huawei.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=thunder.leizhen@huawei.com \
    --cc=will@kernel.org \
    --cc=xuqiang36@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®