Allow larger fraction of CPU to be used by netlink
Instead of doing BATCH_DELAY_MS work and BATCH_DELAY_MS sleep, add a BATCH_WORK_MS (40) and lower BATCH_DELAY_MS (10), so we'll work 80% of the time, and consume netlink messages 20% of the time. Also raise the total batch size to 8K because on my test machine we run 2K in 13ms or 8K in ~50ms.
This commit is contained in:
@ -47,6 +47,7 @@ lcp_nl_main_t lcp_nl_main = {
|
|||||||
.rx_buf_size = NL_RX_BUF_SIZE_DEF,
|
.rx_buf_size = NL_RX_BUF_SIZE_DEF,
|
||||||
.tx_buf_size = NL_TX_BUF_SIZE_DEF,
|
.tx_buf_size = NL_TX_BUF_SIZE_DEF,
|
||||||
.batch_size = NL_BATCH_SIZE_DEF,
|
.batch_size = NL_BATCH_SIZE_DEF,
|
||||||
|
.batch_work_ms = NL_BATCH_WORK_MS_DEF,
|
||||||
.batch_delay_ms = NL_BATCH_DELAY_MS_DEF,
|
.batch_delay_ms = NL_BATCH_DELAY_MS_DEF,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -255,7 +256,7 @@ lcp_nl_process_msgs (void)
|
|||||||
lcpm->lcp_sync = 0;
|
lcpm->lcp_sync = 0;
|
||||||
|
|
||||||
/* process a batch of messages. break if we hit our batch_size
|
/* process a batch of messages. break if we hit our batch_size
|
||||||
* count limit or batch_delay_ms time limit.
|
* count limit or batch_work_ms time limit.
|
||||||
*
|
*
|
||||||
* We do this, because netlink messages will continue to be sourced
|
* We do this, because netlink messages will continue to be sourced
|
||||||
* by the kernel, and we need to periodically read them before they
|
* by the kernel, and we need to periodically read them before they
|
||||||
@ -277,10 +278,10 @@ lcp_nl_process_msgs (void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usecs = (u64) (1e6 * (vlib_time_now (vlib_get_main ()) - start));
|
usecs = (u64) (1e6 * (vlib_time_now (vlib_get_main ()) - start));
|
||||||
if (usecs >= 1e3 * nm->batch_delay_ms)
|
if (usecs >= 1e3 * nm->batch_work_ms)
|
||||||
{
|
{
|
||||||
NL_INFO ("process_msgs: batch_delay_ms %u reached, yielding",
|
NL_INFO ("process_msgs: batch_work_ms %u reached, yielding",
|
||||||
nm->batch_delay_ms);
|
nm->batch_work_ms);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,9 @@ typedef enum nl_event_type_t_
|
|||||||
|
|
||||||
#define NL_RX_BUF_SIZE_DEF (1 << 27) /* 128 MB */
|
#define NL_RX_BUF_SIZE_DEF (1 << 27) /* 128 MB */
|
||||||
#define NL_TX_BUF_SIZE_DEF (1 << 18) /* 256 kB */
|
#define NL_TX_BUF_SIZE_DEF (1 << 18) /* 256 kB */
|
||||||
#define NL_BATCH_SIZE_DEF (1 << 11) /* 2048 */
|
#define NL_BATCH_SIZE_DEF (1 << 13) /* 8192 */
|
||||||
#define NL_BATCH_DELAY_MS_DEF 50 /* 50 ms, max 20 batch/s */
|
#define NL_BATCH_WORK_MS_DEF 40 /* 40 ms */
|
||||||
|
#define NL_BATCH_DELAY_MS_DEF 10 /* 10 ms, max 20 batch/s */
|
||||||
|
|
||||||
#define NL_DBG(...) vlib_log_debug (lcp_nl_main.nl_logger, __VA_ARGS__);
|
#define NL_DBG(...) vlib_log_debug (lcp_nl_main.nl_logger, __VA_ARGS__);
|
||||||
#define NL_INFO(...) vlib_log_info (lcp_nl_main.nl_logger, __VA_ARGS__);
|
#define NL_INFO(...) vlib_log_info (lcp_nl_main.nl_logger, __VA_ARGS__);
|
||||||
@ -90,6 +91,7 @@ typedef struct lcp_nl_main
|
|||||||
u32 rx_buf_size;
|
u32 rx_buf_size;
|
||||||
u32 tx_buf_size;
|
u32 tx_buf_size;
|
||||||
u32 batch_size;
|
u32 batch_size;
|
||||||
|
u32 batch_work_ms;
|
||||||
u32 batch_delay_ms;
|
u32 batch_delay_ms;
|
||||||
|
|
||||||
} lcp_nl_main_t;
|
} lcp_nl_main_t;
|
||||||
|
Reference in New Issue
Block a user