• sundb's avatar
    Fix oom-score-adj test due to no permission (#12887) · bef57153
    sundb authored
    
    
    Fix #12792
    
    On ubuntu 23(lunar), non-root users will not be allowed to change the
    oom_score_adj of a process to a value that is too low.
    Since terminal's default oom_score_adj is 200, if we run the test on
    terminal, we won't be able to set the oom_score_adj of the redis process
    to 9 or 22, which is too low.
    
    Reproduction on ubuntu 23(lunar) terminal:
    ```sh
    $ cat /proc/`pgrep redis-server`/oom_score_adj
    200
    $ echo 100 > /proc/`pgrep redis-server`/oom_score_adj
    # success without error
    $ echo 99 > /proc/`pgrep redis-server`/oom_score_adj
    echo: write error: Permission denied
    ```
    
    As from the output above, we can only set the minimum oom score of redis
    processes to 100.
    By modifying the test, make oom_score_adj only increase upwards and not
    decrease.
    
    ---------
    Co-authored-by: default avatardebing.sun <debing.sun@redis.com>
    bef57153
oom-score-adj.tcl 4.79 KB