On Fri, 2010-05-14 at 18:30 -0700, Joe Eykholt wrote:
> > But for "send solicitation after 2.5 * fka instead of 3 * fka"
> patch, if
> > Joe doesnt have objections, we can submit it as is.
> 
> Let me send an alternative patch that I think will fix that
> and solves the problem of the extra mod_timers() as well.

As I understand likely your fix will be for extra mod_timer for 2.5  KA
period in fcf age out func but to avoid related duplicate work for sure,
letting you know that I've eliminated a extra mod_timer in same func,
see patch details below. My patch is tested by me and will be out in a
day or two once I get yes by its validation, so you may consider using
this patch to avoid conflicts later in your patch.

--

libfcoe: higher cpu usages (~25%) due to fip timeout on each jiffy

From: Vasu Dev <[email protected]>

fip timer fcoe_ctlr_timeout is called every jiffy when FIP keep
alive turned off due to D bit flag fcf->fd_flags set to 1.

In this case select fcf timeout value was used on each timeout to
arm next timeout but this value was not mostly updated once fcf is
selected and that was causing timeout handler fcoe_ctlr_timeout to
fire on very next jiffy again leading to higher cpu usages.

To fix this, used fka_period which is typically 8 seconds to only
age out any fcf since keep alives timeouts are disabled in this case.

Also stops updating ctlr_ka_time and then mod_timer using this
when fcf->fd_flags is set.

Updates select fcf time only if fcf is not already selected or
select time is not already determined from parse adv, and then
have select time cleared only once after fcf is selected.

Signed-off-by: Vasu Dev <[email protected]>
---

 drivers/scsi/fcoe/libfcoe.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)


diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 50aaa4b..68634aa 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -603,13 +603,10 @@ static void fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip)
                        sel_time = fcf->time;
                }
        }
-       if (sel_time) {
-               sel_time += msecs_to_jiffies(FCOE_CTLR_START_DELAY);
+
+       if (!(fip->sel_fcf || fip->sel_time)) {
                fip->sel_time = sel_time;
-               if (time_before(sel_time, fip->timer.expires))
-                       mod_timer(&fip->timer, sel_time);
-       } else {
-               fip->sel_time = 0;
+               fip->sel_time += msecs_to_jiffies(FCOE_CTLR_START_DELAY);
        }
 }

@@ -767,7 +764,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, 
struct sk_buff *skb)
                 * ignored after a usable solicited advertisement
                 * has been received.
                 */
-               if (fcf == fip->sel_fcf) {
+               if (fcf == fip->sel_fcf && !fcf->fd_flags) {
                        fip->ctlr_ka_time -= fcf->fka_period;
                        fip->ctlr_ka_time += new.fka_period;
                        if (time_before(fip->ctlr_ka_time, fip->timer.expires))
@@ -805,7 +802,7 @@ static void fcoe_ctlr_recv_adv(struct fcoe_ctlr *fip, 
struct sk_buff *skb)
         * If this is the first validated FCF, note the time and
         * set a timer to trigger selection.
         */
-       if (mtu_valid && !fip->sel_time && fcoe_ctlr_fcf_usable(fcf)) {
+       if (mtu_valid && !fip->sel_fcf && fcoe_ctlr_fcf_usable(fcf)) {
                fip->sel_time = jiffies +
                        msecs_to_jiffies(FCOE_CTLR_START_DELAY);
                if (!timer_pending(&fip->timer) ||
@@ -1202,11 +1199,11 @@ static void fcoe_ctlr_timeout(unsigned long arg)
                if (time_after(next_timer, fip->port_ka_time))
                        next_timer = fip->port_ka_time;
                mod_timer(&fip->timer, next_timer);
-       } else if (fip->sel_time) {
-               next_timer = fip->sel_time +
-                       msecs_to_jiffies(FCOE_CTLR_START_DELAY);
-               mod_timer(&fip->timer, next_timer);
-       }
+       } else if (fip->sel_time)
+               mod_timer(&fip->timer, fip->sel_time);
+       else if (sel)
+               mod_timer(&fip->timer, jiffies + fcf->fka_period);
+
        if (fip->send_ctlr_ka || fip->send_port_ka)
                schedule_work(&fip->timer_work);
        spin_unlock_bh(&fip->lock);


_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to