Page MenuHomeFreeBSD

D44420.id135932.diff
No OneTemporary

D44420.id135932.diff

Index: sys/netinet/tcp_hpts.c
===================================================================
--- sys/netinet/tcp_hpts.c
+++ sys/netinet/tcp_hpts.c
@@ -216,6 +216,7 @@
void *ie_cookie;
uint16_t p_num; /* The hpts number one per cpu */
uint16_t p_cpu; /* The hpts CPU */
+ uint8_t hit_callout_thresh;
/* There is extra space in here */
/* Cache line 0x100 */
struct callout co __aligned(CACHE_LINE_SIZE);
@@ -269,6 +270,11 @@
int cpu[MAXCPU];
} hpts_domains[MAXMEMDOM];
+counter_u64_t hpts_that_need_softclock;
+SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, needsoftclock, CTLFLAG_RD,
+ &hpts_that_need_softclock,
+ "Number of hpts threads that need softclock");
+
counter_u64_t hpts_hopelessly_behind;
SYSCTL_COUNTER_U64(_net_inet_tcp_hpts_stats, OID_AUTO, hopeless, CTLFLAG_RD,
@@ -334,7 +340,7 @@
&tcp_hpts_precision, 120,
"Value for PRE() precision of callout");
SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, cnt_thresh, CTLFLAG_RW,
- &conn_cnt_thresh, 0,
+ &conn_cnt_thresh, DEFAULT_CONNECTION_THESHOLD,
"How many connections (below) make us use the callout based mechanism");
SYSCTL_INT(_net_inet_tcp_hpts, OID_AUTO, logging, CTLFLAG_RW,
&hpts_does_tp_logging, 0,
@@ -1548,6 +1554,9 @@
struct tcp_hpts_entry *hpts;
int ticks_ran;
+ if (counter_u64_fetch(hpts_that_need_softclock) == 0)
+ return;
+
hpts = tcp_choose_hpts_to_run();
if (hpts->p_hpts_active) {
@@ -1683,6 +1692,13 @@
ticks_ran = tcp_hptsi(hpts, 1);
tv.tv_sec = 0;
tv.tv_usec = hpts->p_hpts_sleep_time * HPTS_TICKS_PER_SLOT;
+ if ((hpts->p_on_queue_cnt > conn_cnt_thresh) && (hpts->hit_callout_thresh == 0)) {
+ hpts->hit_callout_thresh = 1;
+ counter_u64_add(hpts_that_need_softclock, 1);
+ } else if ((hpts->p_on_queue_cnt <= conn_cnt_thresh) && (hpts->hit_callout_thresh == 1)) {
+ hpts->hit_callout_thresh = 0;
+ counter_u64_add(hpts_that_need_softclock, -1);
+ }
if (hpts->p_on_queue_cnt >= conn_cnt_thresh) {
if(hpts->p_direct_wake == 0) {
/*
@@ -1818,6 +1834,7 @@
cpu_top = NULL;
#endif
tcp_pace.rp_num_hptss = ncpus;
+ hpts_that_need_softclock = counter_u64_alloc(M_WAITOK);
hpts_hopelessly_behind = counter_u64_alloc(M_WAITOK);
hpts_loops = counter_u64_alloc(M_WAITOK);
back_tosleep = counter_u64_alloc(M_WAITOK);
@@ -2042,6 +2059,7 @@
free(tcp_pace.grps, M_TCPHPTS);
#endif
+ counter_u64_free(hpts_that_need_softclock);
counter_u64_free(hpts_hopelessly_behind);
counter_u64_free(hpts_loops);
counter_u64_free(back_tosleep);

File Metadata

Mime Type
text/plain
Expires
Fri, Aug 7, 11:12 PM (18 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36200150
Default Alt Text
D44420.id135932.diff (2 KB)

Event Timeline