diff options
author | Jack Wang <jinpu.wang@cloud.ionos.com> | 2021-06-21 08:53:38 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2021-06-22 03:02:21 +0300 |
commit | df1885a755784da3ef285f36d9230c1d090ef186 (patch) | |
tree | ca8f1edf4158f18b1652aa1a3014685b1c7c806d | |
parent | 2ece9ec62e5b276b4635d391c844b2ffcd10bbf1 (diff) | |
download | linux-df1885a755784da3ef285f36d9230c1d090ef186.tar.xz |
RDMA/rtrs_clt: Alloc less memory with write path fast memory registration
With write path fast memory registration, we need less memory for
each request.
With fast memory registration, we can reduce max_send_sge to save
memory usage.
Also convert the kmalloc_array to kcalloc.
Link: https://lore.kernel.org/r/20210621055340.11789-4-jinpu.wang@ionos.com
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Reviewed-by: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-rw-r--r-- | drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 82c4a1273321..37fc0f203980 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1372,8 +1372,7 @@ static int alloc_sess_reqs(struct rtrs_clt_sess *sess) if (!req->iu) goto out; - req->sge = kmalloc_array(clt->max_segments + 1, - sizeof(*req->sge), GFP_KERNEL); + req->sge = kcalloc(2, sizeof(*req->sge), GFP_KERNEL); if (!req->sge) goto out; @@ -1675,7 +1674,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) sess->queue_depth * 3 + 1); max_recv_wr = min_t(int, wr_limit, sess->queue_depth * 3 + 1); - max_send_sge = sess->clt->max_segments + 1; + max_send_sge = 2; } cq_num = max_send_wr + max_recv_wr; /* alloc iu to recv new rkey reply when server reports flags set */ |