[PATCH 08/16] nvme-auth: don't keep long lived 4k dhchap buffer

Christoph Hellwig hch at lst.de
Tue Nov 8 22:39:14 PST 2022


On Wed, Nov 09, 2022 at 05:44:11AM +0200, Sagi Grimberg wrote:
> dhchap structure is per-queue, it is wasteful to keep it for the entire
> lifetime of the queue. Allocate it dynamically and get rid of it after
> authentication. We don't need kzalloc because all accessors are clearing
> it before writing to it.

Btw, do we need a mempool here to make sure we always get one for
a reconnect under memory pressure?

> +	/*
> +	 * Allocate a large enough buffer for the entire negotiation:
> +	 * 4k should be enough to ffdhe8192.
> +	 */
> +	chap->buf_size = 4096;

Same comments as for Hannes previous series:  no need for ->buf_size,
this can be a global constant.

And in the comment the should is weird, it is enough.



More information about the Linux-nvme mailing list