74b1de
From 23091d24d34102c7938ae2890930b73c89c5a8e7 Mon Sep 17 00:00:00 2001
74b1de
From: Mohit Agrawal <moagrawal@redhat.com>
74b1de
Date: Tue, 22 Oct 2019 18:52:25 +0530
74b1de
Subject: [PATCH 313/313] extras: Cgroup(CPU/Mem) restriction are not working
74b1de
 on gluster process
74b1de
74b1de
Problem: After Configure the Cgroup(CPU/MEM) limit to a gluster processes
74b1de
         resource(CPU/MEM) limits are not applicable to the gluster
74b1de
         processes.Cgroup limits are not applicable because all threads are
74b1de
         not moved into a newly created cgroup to apply restriction.
74b1de
74b1de
Solution: To move a gluster thread to newly created cgroup change the
74b1de
          condition in script
74b1de
74b1de
> Change-Id: I8ad81c69200e4ec43a74f6052481551cf835354c
74b1de
> Fixes: bz#1764208
74b1de
> (Cherry pick from commit 38de02012948013a88597545cf49380ce97f6fa7)
74b1de
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/23599/)
74b1de
> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
74b1de
74b1de
Change-Id: I8ad81c69200e4ec43a74f6052481551cf835354c
74b1de
BUG: 1764202
74b1de
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/183730
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74b1de
---
74b1de
 extras/control-cpu-load.sh | 2 +-
74b1de
 extras/control-mem.sh      | 2 +-
74b1de
 2 files changed, 2 insertions(+), 2 deletions(-)
74b1de
74b1de
diff --git a/extras/control-cpu-load.sh b/extras/control-cpu-load.sh
74b1de
index b739c82..52dcf62 100755
74b1de
--- a/extras/control-cpu-load.sh
74b1de
+++ b/extras/control-cpu-load.sh
74b1de
@@ -104,7 +104,7 @@ echo "Setting $quota_value to cpu.cfs_quota_us for gluster_cgroup."
74b1de
 echo ${quota_value} > ${LOC}/${cgroup_name}/cpu.cfs_quota_us
74b1de
 
74b1de
 if ps -T -p ${daemon_pid} | grep gluster > /dev/null; then
74b1de
-  for thid in `ps -T -p ${daemon_pid} | grep gluster | awk -F " " '{print $2}'`;
74b1de
+  for thid in `ps -T -p ${daemon_pid} | grep -v SPID | awk -F " " '{print $2}'`;
74b1de
     do
74b1de
       echo ${thid} > ${LOC}/${cgroup_name}/tasks ;
74b1de
     done
74b1de
diff --git a/extras/control-mem.sh b/extras/control-mem.sh
74b1de
index 38aa2a0..91b36f8 100755
74b1de
--- a/extras/control-mem.sh
74b1de
+++ b/extras/control-mem.sh
74b1de
@@ -116,7 +116,7 @@ else
74b1de
 fi
74b1de
 
74b1de
 if ps -T -p ${daemon_pid} | grep gluster > /dev/null; then
74b1de
-  for thid in `ps -T -p ${daemon_pid} | grep gluster | awk -F " " '{print $2}'`;
74b1de
+  for thid in `ps -T -p ${daemon_pid} | grep -v SPID | awk -F " " '{print $2}'`;
74b1de
     do
74b1de
       echo ${thid} > ${LOC}/${cgroup_name}/tasks ;
74b1de
     done
74b1de
-- 
74b1de
1.8.3.1
74b1de