diff mbox series

[ovs-dev,v3,2/2] ovs-ctl: Allow to set oom-score for ovs daemons.

Message ID 20250120144448.1338584-2-roid@nvidia.com
State Superseded
Headers show
Series [ovs-dev,v3,1/2] dpdk: Add ovs-appctl dpdk/get-memzone-stats command. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Roi Dayan Jan. 20, 2025, 2:44 p.m. UTC
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 <roid@nvidia.com>
Acked-by: Eli Britstein <elibr@nvidia.com>
---

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(+)

Comments

Eelco Chaudron Jan. 21, 2025, 9:18 a.m. UTC | #1
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 <roid@nvidia.com>
> Acked-by: Eli Britstein <elibr@nvidia.com>

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
Eelco Chaudron Jan. 21, 2025, 9:22 a.m. UTC | #2
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 <roid@nvidia.com>
> Acked-by: Eli Britstein <elibr@nvidia.com>

Recheck-request: github-robot
Roi Dayan Jan. 21, 2025, 10:39 a.m. UTC | #3
On 21/01/2025 11:18, Eelco Chaudron wrote:
> 
> 
> 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 <roid@nvidia.com>
>> Acked-by: Eli Britstein <elibr@nvidia.com>
> 
> 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.
> 

sure. thanks.

>> +
>>  * ``--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
>
diff mbox series

Patch

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.
+
 * ``--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" \