Skip to content

Commit

Permalink
Update oom_score_adjusted_by_redis to oom_score_adjusted_by_valkey in…
Browse files Browse the repository at this point in the history
… server.c (valkey-io#229)

Update oom_score_adjusted_by_redis to oom_score_adjusted_by_valkey in
server.c

Signed-off-by: Shivshankar-Reddy <[email protected]>
  • Loading branch information
Shivshankar-Reddy authored Apr 18, 2024
1 parent 3040c43 commit af47cff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2237,16 +2237,16 @@ int setOOMScoreAdj(int process_class) {
* when another configuration parameter was invalid and causes a rollback after
* applying a new oom-score) we can return to the oom-score value from before our
* adjustments. */
static int oom_score_adjusted_by_redis = 0;
static int oom_score_adjusted_by_valkey = 0;
static int oom_score_adj_base = 0;

int fd;
int val;
char buf[64];

if (server.oom_score_adj != OOM_SCORE_ADJ_NO) {
if (!oom_score_adjusted_by_redis) {
oom_score_adjusted_by_redis = 1;
if (!oom_score_adjusted_by_valkey) {
oom_score_adjusted_by_valkey = 1;
/* Backup base value before enabling the server control over oom score */
fd = open("/proc/self/oom_score_adj", O_RDONLY);
if (fd < 0 || read(fd, buf, sizeof(buf)) < 0) {
Expand All @@ -2263,8 +2263,8 @@ int setOOMScoreAdj(int process_class) {
val += oom_score_adj_base;
if (val > 1000) val = 1000;
if (val < -1000) val = -1000;
} else if (oom_score_adjusted_by_redis) {
oom_score_adjusted_by_redis = 0;
} else if (oom_score_adjusted_by_valkey) {
oom_score_adjusted_by_valkey = 0;
val = oom_score_adj_base;
}
else {
Expand Down

0 comments on commit af47cff

Please sign in to comment.