mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
dpif-netdev: Set timer slack for PMD threads.
The default Linux timer slack groups timer expires into 50 uS intervals.
With some traffic patterns this can mean that returning to process
packets after a sleep takes too long and packets are dropped.
Add a helper to util.c and set use it to reduce the timer slack
for PMD threads, so that sleeps with smaller resolutions can be done
to prevent sleeping for too long.
Fixes: de3bbdc479
("dpif-netdev: Add PMD load based sleeping.")
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2023-January/401121.html
Reported-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Co-authored-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
e24b68fa70
commit
f62629a558
16
lib/util.c
16
lib/util.c
@@ -25,6 +25,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef __linux__
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "bitmap.h"
|
||||
@@ -2419,6 +2422,19 @@ xnanosleep_no_quiesce(uint64_t nanoseconds)
|
||||
xnanosleep__(nanoseconds);
|
||||
}
|
||||
|
||||
#if __linux__
|
||||
void
|
||||
set_timer_resolution(unsigned long nanoseconds)
|
||||
{
|
||||
prctl(PR_SET_TIMERSLACK, nanoseconds);
|
||||
}
|
||||
#else
|
||||
void
|
||||
set_timer_resolution(unsigned long nanoseconds OVS_UNUSED)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Determine whether standard output is a tty or not. This is useful to decide
|
||||
* whether to use color output or not when --color option for utilities is set
|
||||
* to `auto`.
|
||||
|
Reference in New Issue
Block a user