From de07155bfae3c5846797cbb19ee044751cbe6f6e Mon Sep 17 00:00:00 2001 From: Oleksandr Natalenko Date: Wed, 28 Sep 2016 14:29:23 +0200 Subject: glusterfsd/main: fix OOM adjustment for older kernels Milind Changire reported that GlusterFS fails to build on RHEL5 because linux/oom.h is unavailable. Milind's initial patch disables OOM adjustment completely for those environments that do not have this header. However, I'd take another approach that: 1) checks for linux/oom.h in compile-time and defines necessary constants if the header is not present; 2) checks for available OOM API in /proc in run-time and uses it accordingly. This allows OOM to be adjusted properly on RHEL5 (the kernel is pretty new to present /proc API for that) as well as RHEL6 (the kernel has many thing backported including new /proc API). Change-Id: I1bc610586872d208430575c149a7d0c54bd82370 BUG: 1379769 Signed-off-by: Oleksandr Natalenko Reviewed-on: http://review.gluster.org/15587 Tested-by: Oleksandr Natalenko Reviewed-by: Niels de Vos Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- libglusterfs/src/glusterfs.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src/glusterfs.h') diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 5777974676f..24b8065b66d 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -350,7 +350,6 @@ struct _cmd_args { int acl; int selinux; int capability; - char *oom_score_adj; int enable_ino32; int worm; int mac_compat; @@ -396,6 +395,11 @@ struct _cmd_args { /* Should management connections use SSL? */ int secure_mgmt; + + /* Linux-only OOM killer adjustment */ +#ifdef GF_LINUX_HOST_OS + char *oom_score_adj; +#endif }; typedef struct _cmd_args cmd_args_t; -- cgit