Re: Excessive memory usage when infiniband config is enabled

Jason Gunthorpe
2024-05-07T16:38:01Z

On Tue, May 07, 2024 at 05:24:51PM +0200, Zhu Yanjun wrote:
> 在 2024/5/7 15:32, Konstantin Taranov 写道:
> > > Hello Leon,
> > >
> > > I feel that it's a bug because I don't understand why is this module/option
> > > allocating 6GB of RAM without any explicit configuration or usage from us.
> > > It's also worth mentioning that we are using the default linux-image from
> > > Debian bookworm, and it took us a long time to understand the reason
> > > behind this memory increase by bisecting the kernel's config file.
> > > Moreover the documentation of the module doesn't mention anything
> > > regarding additional memory usage, we're talking about an increase of 6Gb
> > > which is huge since we're not using the option.
> > > So is that an expected behavior, to have this much increase in the memory
> > > consumption, when activating the RDMA option even if we're not using it ? If
> > > that's the case, perhaps it would be good to mention this in the
> > > documentation.
> > >
> > > Thank you
> > >
> >
> > Hi Brian,
> >
> > I do not think it is a bug. The high memory usage seems to come from these lines:
> > rsrc_size = irdma_calc_mem_rsrc_size(rf);
> > rf->mem_rsrc = vzalloc(rsrc_size);
>
> Exactly. The memory usage is related with the number of QP.
> When on irdma, the Queue Pairs is 4092, Completion Queues is 8189, the
> memory usage is about 4194302.
>
> The command "modprobe irdma limits_sel" will change QP numbers.
> 0 means minimum, up to 124 QPs.
>
> Please use the command "modprobe irdma limits_sel=0" to make tests.
> Please let us know the test results.

It seems like a really unfortunate design choice in this driver to not
have dynamic memory allocation.

Burning 6G on every server that has your HW, regardless if any RDMA
apps are run, seems completely excessive.

Jason