[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tools: fix oom setting of xenstored



On 19.10.21 08:54, Jan Beulich wrote:
On 19.10.2021 06:41, Juergen Gross wrote:
--- a/tools/hotplug/Linux/launch-xenstore.in
+++ b/tools/hotplug/Linux/launch-xenstore.in
@@ -60,7 +60,7 @@ test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . 
@CONFIG_DIR@/@CONFIG_LEAF
                echo "No xenstored found"
                exit 1
        }
-       [ -z "$XENSTORED_OOM_MEM_THRESHOLD" ] || XENSTORED_OOM_MEM_THRESHOLD=50
+       [ -z "$XENSTORED_OOM_MEM_THRESHOLD" ] && XENSTORED_OOM_MEM_THRESHOLD=50

Is resilience against "set -e" being in effect of interest? If so I
think this would want to be

I don't think set -e would have a negative effect on above line. The
bash man-page tells me that:

  The shell does not exit if the command that fails is part of the
  command list immediately following a while or until keyword, part of
  the test following the if, ...

And I believe that "[ ... ]" is treated like an "if". A short test
showed that bash indeed does not exit in this case:

  ( set -e; [ -z "" ] && xx=okay; echo $xx; )

This will print "okay", so bash didn't exit.


        [ -n "$XENSTORED_OOM_MEM_THRESHOLD" ] || XENSTORED_OOM_MEM_THRESHOLD=50

        XS_OOM_SCORE=-$(($XENSTORED_OOM_MEM_THRESHOLD * 10))

Alternatively, how about dropping the line above and using

        XS_OOM_SCORE=-$((${XENSTORED_OOM_MEM_THRESHOLD:-50} * 10))

here?

This would be an option, yes.

Unless a maintainer wants me to send another patch with this change I'll
keep it as it is now.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.