Whamcloud - gitweb
LU-6122 lnet: Allocate the correct number of rtr buffers 19/13519/11
authorAmir Shehata <amir.shehata@intel.com>
Fri, 23 Jan 2015 23:27:22 +0000 (15:27 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 18 Aug 2015 11:10:01 +0000 (11:10 +0000)
commit6182af3703026ac633b6f0bddc3e90958dc9631d
treec75ab47bd85f5a9130f75a94d7766a1e0fff81c4
parent259c1ec0cfb76b2645efa2be6ec7ad48229eb658
LU-6122 lnet: Allocate the correct number of rtr buffers

This patch ensures that the correct number of router buffers are
allocated.  It keeps a count that keeps track of the number of
buffers allocated.  Another count keeps the number of buffers
requested. The number of buffers allocated is set when creating
new buffers and reduced when buffers are freed.

The number of requested buffer is set when the buffers are
allocated and is checked when credits are returned to determine
whether the buffer should be freed or kept.

In lnet_rtrpool_adjust_bufs() grab lnet_net_lock() before using
rbp_nbuffers to ensure that it doesn't change by
lnet_return_rx_credits_locked() during the process of allocating
new buffers.  All other access to rbp_nbuffers is already being
protected by lnet_net_lock().

This avoids the case where we allocate less than the desired
number of buffers.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Change-Id: I96627cc8ba3d3d70a0bf581b21ccd3c9b2de327f
Reviewed-on: http://review.whamcloud.com/13519
Tested-by: Jenkins
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/include/lnet/lib-types.h
lnet/lnet/lib-move.c
lnet/lnet/router.c