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