Skip to content

Commit

Permalink
ovs-ctl: Allow to set oom-score for ovs daemons.
Browse files Browse the repository at this point in the history
Allow to set oom-score with --oom-score argument.
This argument can be set in ovs config file.
In rhel can set OPTIONS in /etc/sysconfig/openvswitch.
In debian can set OVS_CTL_OPTS in /etc/default/openvswitch-switch.

Acked-by: Eli Britstein <[email protected]>
Acked-by: Simon Horman <[email protected]>
Signed-off-by: Roi Dayan <[email protected]>
Signed-off-by: Eelco Chaudron <[email protected]>
  • Loading branch information
roidayan authored and chaudron committed Jan 23, 2025
1 parent ae8dafe commit ad59bb8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Documentation/ref/ovs-ctl.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ The following options are less important:
place, because, perhaps, OVSDB manager is running on the same host
as OVS and share similar attack vectors.

* ``--oom-score=<score>``

Sets the Linux Out-Of-Memory (OOM) killer score for the OVS daemon
after it's been started.

* ``--ovsdb-server-priority=<niceness>`` or
``--ovs-vswitchd-priority=<niceness>``

Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ Post-v3.5.0
--------------------
- DPDK:
* New debug appctl command 'dpdk/get-memzone-stats'.
- ovs-ctl:
* Added a new option, --oom-score=<score>, to set the daemons' Linux
Out-Of-Memory (OOM) killer score.


v3.5.0 - xx xxx xxxx
Expand Down
2 changes: 2 additions & 0 deletions utilities/ovs-ctl.in
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ set_defaults () {
OVS_MONITOR_IPSEC_OPTIONS=
OVSDB_SERVER_UMASK=
OVS_VSWITCHD_UMASK=
OOM_SCORE=

DB_FILE=$dbdir/conf.db
DB_SOCK=$rundir/db.sock
Expand Down Expand Up @@ -448,6 +449,7 @@ Less important options for "start", "restart" and "force-reload-kmod":
--no-full-hostname set short hostname instead of full hostname
--no-record-hostname do not attempt to determine/record system
hostname as part of start command
--oom-score=SCORE Set oom-score after starting ovs daemon.
Debugging options for "start", "restart" and "force-reload-kmod":
--ovsdb-server-wrapper=WRAPPER
Expand Down
4 changes: 4 additions & 0 deletions utilities/ovs-lib.in
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ start_daemon () {
umask "$previuos_umask_value"
fi

if test X"$OOM_SCORE" != X; then
echo "$OOM_SCORE" > /proc/`cat $rundir/$daemon.pid`/oom_score_adj 2>/dev/null
fi

if test X"$strace" != X; then
# Strace doesn't have the -D option so we attach after the fact.
setsid $strace -o "$logdir/$daemon.strace.log" \
Expand Down

0 comments on commit ad59bb8

Please sign in to comment.