cb8e9e
From 24bcca8e65c5c0f7274f552bf54cfe58a9548c47 Mon Sep 17 00:00:00 2001
cb8e9e
From: Niels de Vos <ndevos@redhat.com>
cb8e9e
Date: Mon, 15 Jun 2015 11:25:36 +0200
cb8e9e
Subject: [PATCH 076/101] upcall: prevent busy loop in reaper thread
cb8e9e
cb8e9e
http://review.gluster.org/10342 introduced a cleanup thread for expired
cb8e9e
client entries. When enabling the 'features.cache-invalidation' volume
cb8e9e
option, the brick process starts to run in a busy-loop. Obviously this
cb8e9e
is not intentional, and a process occupying 100% of the cycles on a CPU
cb8e9e
or core is not wanted.
cb8e9e
cb8e9e
Cherry picked from commit a367d4c6965e1f0da36f17ab6c5fdbd37925ebdd:
cb8e9e
> Change-Id: I453c612d72001f4d8bbecdd5ac07aaed75b43914
cb8e9e
> BUG: 1200267
cb8e9e
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
cb8e9e
> Reviewed-on: http://review.gluster.org/11198
cb8e9e
> Reviewed-by: soumya k <skoduri@redhat.com>
cb8e9e
> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
cb8e9e
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
cb8e9e
cb8e9e
BUG: 1231651
cb8e9e
Change-Id: Ic2c9f91971f7476dea441928da7096e2b1eb9a50
cb8e9e
Signed-off-by: Niels de Vos <ndevos@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/50718
cb8e9e
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
cb8e9e
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
cb8e9e
Tested-by: Soumya Koduri <skoduri@redhat.com>
cb8e9e
---
cb8e9e
 xlators/features/upcall/src/upcall-internal.c |    5 +++++
cb8e9e
 1 files changed, 5 insertions(+), 0 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c
cb8e9e
index e13097c..cd4abb6 100644
cb8e9e
--- a/xlators/features/upcall/src/upcall-internal.c
cb8e9e
+++ b/xlators/features/upcall/src/upcall-internal.c
cb8e9e
@@ -402,6 +402,7 @@ upcall_reaper_thread (void *data)
cb8e9e
         upcall_inode_ctx_t *inode_ctx   = NULL;
cb8e9e
         upcall_inode_ctx_t *tmp         = NULL;
cb8e9e
         xlator_t           *this        = NULL;
cb8e9e
+        time_t              timeout     = 0;
cb8e9e
 
cb8e9e
         this = (xlator_t *)data;
cb8e9e
         GF_ASSERT (this);
cb8e9e
@@ -434,6 +435,10 @@ upcall_reaper_thread (void *data)
cb8e9e
                         }
cb8e9e
                         UNLOCK (&priv->inode_ctx_lk);
cb8e9e
                 }
cb8e9e
+
cb8e9e
+                /* don't do a very busy loop */
cb8e9e
+                timeout = get_cache_invalidation_timeout (this);
cb8e9e
+                sleep (timeout / 2);
cb8e9e
         }
cb8e9e
 
cb8e9e
         return NULL;
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e