Whamcloud - gitweb
LU-7766 lnet: Don't call roundup_pow_of_two on zero in LNetEQAlloc 70/18370/2
authorOleg Drokin <oleg.drokin@intel.com>
Tue, 9 Feb 2016 18:19:11 +0000 (13:19 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 20 Feb 2016 20:57:28 +0000 (20:57 +0000)
roundup_pow_of_two return when called on a zero argument is
undefined, so don't call it like that.

This fixes a problem introduced by commit http://review.whamcloud.com/16914
since 0 is a valid count parameter for LNetEQAlloc. Also manifesting
itself as an annoying kernel warning:
LNet: 3486:0:(lib-eq.c:85:LNetEQAlloc()) EQ callback is guaranteed to get every event, do you still want to set eqcount 1 for polling event which will have locking overhead? Please contact with developer to confirm

Change-Id: I9874d50807fff7bb3a039aa9c2eb4f9ca8565242
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/18370
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
lnet/lnet/lib-eq.c

index 709ffc9..8e95154 100644 (file)
@@ -78,7 +78,8 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback,
          * overflow, they don't skip entries, so the queue has the same
          * apparent capacity at all times */
 
-       count = roundup_pow_of_two(count);
+       if (count)
+               count = roundup_pow_of_two(count);
 
        if (callback != LNET_EQ_HANDLER_NONE && count != 0) {
                CWARN("EQ callback is guaranteed to get every event, "