On 20 Jan 2025, at 15:44, Roi Dayan wrote:

> 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.
>
> Signed-off-by: Roi Dayan <[email protected]>
> Acked-by: Eli Britstein <[email protected]>

Thanks for the v3, see the comment below.

> ---
>
> Notes:
>     v3
>     - Move oom-score to less important options.
>     - Add oom-score to ovs-ctl.8.rst.
>
>  Documentation/ref/ovs-ctl.8.rst | 4 ++++
>  utilities/ovs-ctl.in            | 2 ++
>  utilities/ovs-lib.in            | 4 ++++
>  3 files changed, 10 insertions(+)
>
> diff --git a/Documentation/ref/ovs-ctl.8.rst b/Documentation/ref/ovs-ctl.8.rst
> index cdbaac4dc0bf..71f3ff9dcd8d 100644
> --- a/Documentation/ref/ovs-ctl.8.rst
> +++ b/Documentation/ref/ovs-ctl.8.rst
> @@ -194,6 +194,10 @@ 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>``
> +
> +  Set oom-score after starting ovs daemon.

The text here should be a bit more explanatory. Maybe something like:

  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>``
>
> diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
> index 57abd3a5b45b..be8cd794135f 100644
> --- a/utilities/ovs-ctl.in
> +++ b/utilities/ovs-ctl.in
> @@ -350,6 +350,7 @@ set_defaults () {
>      OVS_VSWITCHD_OPTIONS=
>      OVSDB_SERVER_UMASK=
>      OVS_VSWITCHD_UMASK=
> +    OOM_SCORE=
>
>      DB_FILE=$dbdir/conf.db
>      DB_SOCK=$rundir/db.sock
> @@ -442,6 +443,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
> diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> index d162227dc5e5..dded0b7c7dca 100644
> --- a/utilities/ovs-lib.in
> +++ b/utilities/ovs-lib.in
> @@ -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" \
> -- 
> 2.21.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to