iscsi-target: Pre-allocate more tags to avoid ack starvation
authorNicholas Bellinger <nab@linux-iscsi.org>
Fri, 10 Jan 2014 02:06:59 +0000 (02:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Feb 2014 19:22:21 +0000 (11:22 -0800)
commit0663ebb3d524621d0baf59cf70bc4d9f4b05560e
tree01dc97bb225dd3ad5a8614cb8205b315569a5474
parentf2d6b1bada7ce0e72258302dbd365e89b4578986
iscsi-target: Pre-allocate more tags to avoid ack starvation

commit 4a4caa29f1abcb14377e05d57c0793d338fb945d upstream.

This patch addresses an traditional iscsi-target fabric ack starvation
issue where iscsit_allocate_cmd() -> percpu_ida_alloc_state() ends up
hitting slow path percpu-ida code, because iscsit_ack_from_expstatsn()
is expected to free ack'ed tags after tag allocation.

This is done to take into account the tags waiting to be acknowledged
and released in iscsit_ack_from_expstatsn(), but who's number are not
directly limited by the CmdSN Window queue_depth being enforced by
the target.

So that said, this patch bumps up the pre-allocated number of
per session tags to:

  (max(queue_depth, ISCSIT_MIN_TAGS) * 2) + ISCSIT_EXTRA_TAGS

for good measure to avoid the percpu_ida_alloc_state() slow path.

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/iscsi/iscsi_target_nego.c