Skip to content

Commit

Permalink
poll: Suppress logging for pmd threads.
Browse files Browse the repository at this point in the history
'Unreasonably long poll interval's are reasonable for PMD threads.
Also reporting of high CPU usage is not necessary.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
igsilya authored and blp committed Jan 11, 2016
1 parent d54b91b commit e79d1ed
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions lib/ovs-thread.c
Expand Up @@ -584,6 +584,15 @@ count_cpu_cores(void)

return n_cores > 0 ? n_cores : 0;
}

/* Returns 'true' if current thread is PMD thread. */
bool
thread_is_pmd(void)
{
const char *name = get_subprogram_name();
return !strncmp(name, "pmd", 3);
}


/* ovsthread_key. */

Expand Down
1 change: 1 addition & 0 deletions lib/ovs-thread.h
Expand Up @@ -523,5 +523,6 @@ bool may_fork(void);
/* Useful functions related to threading. */

int count_cpu_cores(void);
bool thread_is_pmd(void);

#endif /* ovs-thread.h */
4 changes: 3 additions & 1 deletion lib/poll-loop.c
Expand Up @@ -253,7 +253,9 @@ log_wakeup(const char *where, const struct pollfd *pollfd, int timeout)
cpu_usage = get_cpu_usage();
if (VLOG_IS_DBG_ENABLED()) {
level = VLL_DBG;
} else if (cpu_usage > 50 && !VLOG_DROP_INFO(&rl)) {
} else if (cpu_usage > 50
&& !thread_is_pmd()
&& !VLOG_DROP_INFO(&rl)) {
level = VLL_INFO;
} else {
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/timeval.c
Expand Up @@ -270,7 +270,7 @@ time_poll(struct pollfd *pollfds, int n_pollfds, HANDLE *handles OVS_UNUSED,
time_init();
coverage_clear();
coverage_run();
if (*last_wakeup) {
if (*last_wakeup && !thread_is_pmd()) {
log_poll_interval(*last_wakeup);
}
start = time_msec();
Expand Down

0 comments on commit e79d1ed

Please sign in to comment.