From: Jason Gunthorpe <jgg@ziepe.ca>
To: Junxian Huang <huangjunxian6@hisilicon.com>
Cc: Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org, linuxarm@huawei.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH for-next 4/6] RDMA/hns: Support flexible pagesize
Date: Fri, 5 Jan 2024 10:18:49 -0400 [thread overview]
Message-ID: <20240105141849.GE50608@ziepe.ca> (raw)
In-Reply-To: <3d4cdc2e-0053-f486-7323-72127027886f@hisilicon.com>
On Fri, Jan 05, 2024 at 01:55:11PM +0800, Junxian Huang wrote:
>
>
> On 2024/1/5 4:29, Jason Gunthorpe wrote:
> > On Tue, Dec 26, 2023 at 05:16:33PM +0800, Junxian Huang wrote:
> >>
> >>
> >> On 2023/12/26 16:52, Leon Romanovsky wrote:
> >>> On Mon, Dec 25, 2023 at 03:53:28PM +0800, Junxian Huang wrote:
> >>>> From: Chengchang Tang <tangchengchang@huawei.com>
> >>>>
> >>>> In the current implementation, a fixed page size is used to
> >>>> configure the PBL, which is not flexible enough and is not
> >>>> conducive to the performance of the HW.
> >>>>
> >>>> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
> >>>> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
> >>>> ---
> >>>> drivers/infiniband/hw/hns/hns_roce_alloc.c | 6 -
> >>>> drivers/infiniband/hw/hns/hns_roce_device.h | 9 ++
> >>>> drivers/infiniband/hw/hns/hns_roce_mr.c | 168 +++++++++++++++-----
> >>>> 3 files changed, 139 insertions(+), 44 deletions(-)
> >>>
> >>> I'm wonder if the ib_umem_find_best_pgsz() API should be used instead.
> >>> What is missing there?
> >>>
> >>> Thanks
> >>
> >> Actually this API is used for umem.
> >> For kmem, we add hns_roce_find_buf_best_pgsz() to do a similar job.
> >
> > But why do you need to do something like this for kmem? It looked to
> > me like kmem knows its allocation size when it was allocated, how come
> > you need to iterate over all of it again?
> >
> > Jason
> >
>
> kmem was split into multiple small pages for allocation to prevent allocation
> failure due to memory fragmentation.
>
> And now we add this function to confirm whether these small pages have contiguous
> address. If so, they can be combined into one huge page for use, which is more
> likely when iommu/smmu is enabled.
That seems unncessary. The chances you get contiguous pages from
a lot of random allocations is really slim.
If you care about this optimization then you should have the allocator
explicitly request contiguous pages with high order allocations in a
manner that quickly fails and falls back to PAGE_SIZE.
Then you just use the size that the allocator was able to get, not try
to figure it out after the fact.
Jason
next prev parent reply other threads:[~2024-01-05 14:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-25 7:53 [PATCH for-next 0/6] RDMA/hns: Improvement for multi-level addressing Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 1/6] RDMA/hns: Refactor mtr find Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 2/6] RDMA/hns: Refactor mtr_init_buf_cfg() Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 3/6] RDMA/hns: Alloc MTR memory before alloc_mtt() Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 4/6] RDMA/hns: Support flexible pagesize Junxian Huang
2023-12-26 8:52 ` Leon Romanovsky
2023-12-26 9:16 ` Junxian Huang
2023-12-26 9:42 ` Leon Romanovsky
2024-01-04 20:29 ` Jason Gunthorpe
2024-01-05 5:55 ` Junxian Huang
2024-01-05 14:18 ` Jason Gunthorpe [this message]
2024-01-09 1:47 ` Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 5/6] RDMA/hns: Support adaptive PBL hopnum Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 6/6] RDMA/hns: Simplify 'struct hns_roce_hem' allocation Junxian Huang
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=20240105141849.GE50608@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=huangjunxian6@hisilicon.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@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