--- net/ipv4/tcp_minisocks.c.orig 2004-02-27 13:43:11.000000000 -0600 +++ net/ipv4/tcp_minisocks.c 2004-02-27 15:21:18.318890672 -0600 @@ -427,9 +427,7 @@ static u32 twkill_thread_slots; static int tcp_do_twkill_work(int slot, unsigned int quota) { struct tcp_tw_bucket *tw; - struct hlist_node *node, *safe; unsigned int killed; - int ret; /* NOTE: compare this to previous version where lock * was released after detaching chain. It was racy, @@ -438,25 +436,21 @@ static int tcp_do_twkill_work(int slot, * soft irqs are not sequenced. */ killed = 0; - ret = 0; - tw_for_each_inmate(tw, node, safe, - &tcp_tw_death_row[slot]) { + while (killed <= quota && + !hlist_empty(&tcp_tw_death_row[slot])) { + tw = hlist_entry(tcp_tw_death_row[slot].first, struct tcp_tw_bucket, tw_death_node); __tw_del_dead_node(tw); spin_unlock(&tw_death_lock); tcp_timewait_kill(tw); tcp_tw_put(tw); killed++; spin_lock(&tw_death_lock); - if (killed > quota) { - ret = 1; - break; - } } tcp_tw_count -= killed; NET_ADD_STATS_BH(TimeWaited, killed); - return ret; + return killed > quota; } static void tcp_twkill(unsigned long dummy)