Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111246
b: refs/heads/master
c: a919cf4
h: refs/heads/master
v: v3
  • Loading branch information
Sven Wegener authored and Simon Horman committed Aug 14, 2008
1 parent 58d7b86 commit 3b9eade
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 82dfb6f32219d8e6cf6b979a520cb2b11d977d4e
refs/heads/master: a919cf4b6b499416b6e2247dbc79196c4325f2e6
2 changes: 2 additions & 0 deletions trunk/include/net/ip_vs.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
/*
* IPVS rate estimator prototypes (from ip_vs_est.c)
*/
extern int ip_vs_estimator_init(void);
extern void ip_vs_estimator_cleanup(void);
extern void ip_vs_new_estimator(struct ip_vs_stats *stats);
extern void ip_vs_kill_estimator(struct ip_vs_stats *stats);
extern void ip_vs_zero_estimator(struct ip_vs_stats *stats);
Expand Down
8 changes: 6 additions & 2 deletions trunk/net/ipv4/ipvs/ip_vs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1070,10 +1070,12 @@ static int __init ip_vs_init(void)
{
int ret;

ip_vs_estimator_init();

ret = ip_vs_control_init();
if (ret < 0) {
IP_VS_ERR("can't setup control.\n");
goto cleanup_nothing;
goto cleanup_estimator;
}

ip_vs_protocol_init();
Expand Down Expand Up @@ -1106,7 +1108,8 @@ static int __init ip_vs_init(void)
cleanup_protocol:
ip_vs_protocol_cleanup();
ip_vs_control_cleanup();
cleanup_nothing:
cleanup_estimator:
ip_vs_estimator_cleanup();
return ret;
}

Expand All @@ -1117,6 +1120,7 @@ static void __exit ip_vs_cleanup(void)
ip_vs_app_cleanup();
ip_vs_protocol_cleanup();
ip_vs_control_cleanup();
ip_vs_estimator_cleanup();
IP_VS_INFO("ipvs unloaded.\n");
}

Expand Down
18 changes: 11 additions & 7 deletions trunk/net/ipv4/ipvs/ip_vs_est.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ void ip_vs_new_estimator(struct ip_vs_stats *stats)
est->outbps = stats->outbps<<5;

spin_lock_bh(&est_lock);
if (list_empty(&est_list))
mod_timer(&est_timer, jiffies + 2 * HZ);
list_add(&est->list, &est_list);
spin_unlock_bh(&est_lock);
}
Expand All @@ -136,11 +134,6 @@ void ip_vs_kill_estimator(struct ip_vs_stats *stats)

spin_lock_bh(&est_lock);
list_del(&est->list);
while (list_empty(&est_list) && try_to_del_timer_sync(&est_timer) < 0) {
spin_unlock_bh(&est_lock);
cpu_relax();
spin_lock_bh(&est_lock);
}
spin_unlock_bh(&est_lock);
}

Expand All @@ -160,3 +153,14 @@ void ip_vs_zero_estimator(struct ip_vs_stats *stats)
est->inbps = 0;
est->outbps = 0;
}

int __init ip_vs_estimator_init(void)
{
mod_timer(&est_timer, jiffies + 2 * HZ);
return 0;
}

void ip_vs_estimator_cleanup(void)
{
del_timer_sync(&est_timer);
}

0 comments on commit 3b9eade

Please sign in to comment.