[tracker/gdbus-store: 1/3] tracker-store: Drop CPU affinity handling



commit 84d950e4408879619090aa02000647f2dfaefbae
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jan 11 12:38:50 2011 +0100

    tracker-store: Drop CPU affinity handling
    
    The performance issue was no longer noticed since the miner has been
    ported to direct access.

 docs/manpages/tracker-store.1     |    9 --------
 src/tracker-store/tracker-store.c |   42 -------------------------------------
 2 files changed, 0 insertions(+), 51 deletions(-)
---
diff --git a/docs/manpages/tracker-store.1 b/docs/manpages/tracker-store.1
index f98dcc9..0ae14cb 100644
--- a/docs/manpages/tracker-store.1
+++ b/docs/manpages/tracker-store.1
@@ -91,15 +91,6 @@ number represents the number of cached statements to keep around.
 This environment variable is used mainly for testing purposes.
 
 .TP
-.B TRACKER_STORE_DISABLE_CPU_AFFINITY
-Tracker currently uses CPU affinity to improve query times by making
-sure that certain operations are done on the same CPU. This is only
-useful on multi processor systems of course and on some architectures
-has given a yeild of up to 50% performance improvement. The main
-reason for wanting to disable this is if there is an adverse effect.
-This has been seen by using Valgrind with tracker-store for example.
-
-.TP
 .B TRACKER_PRAGMAS_FILE
 Tracker has a fixed set of PRAGMA settings for creating its SQLite connection.
 With this environment variable pointing to a text file you can override these
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 6a53264..2ead759 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -21,10 +21,6 @@
 
 #include "config.h"
 
-#define _GNU_SOURCE
-#include <sched.h>
-#include <pthread.h>
-
 #include <unistd.h>
 #include <sys/types.h>
 
@@ -106,11 +102,6 @@ typedef struct {
 
 static GStaticPrivate private_key = G_STATIC_PRIVATE_INIT;
 
-#ifdef __USE_GNU
-/* cpu used for mainloop thread and main update/query thread */
-static int main_cpu;
-#endif /* __USE_GNU */
-
 static void
 private_free (gpointer data)
 {
@@ -338,21 +329,6 @@ pool_dispatch_cb (gpointer data,
 	TrackerStorePrivate *private;
 	TrackerStoreTask *task;
 
-#ifdef __USE_GNU
-	/* special task, only ever sent to main pool */
-	if (GPOINTER_TO_INT (data) == 1) {
-		if (g_getenv ("TRACKER_STORE_DISABLE_CPU_AFFINITY") == NULL) {
-			cpu_set_t cpuset;
-			CPU_ZERO (&cpuset);
-			CPU_SET (main_cpu, &cpuset);
-
-			/* avoid cpu hopping which can lead to significantly worse performance */
-			pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
-			return;
-		}
-	}
-#endif /* __USE_GNU */
-
 	private = user_data;
 	task = data;
 
@@ -391,9 +367,6 @@ tracker_store_init (void)
 	TrackerStorePrivate *private;
 	gint i;
 	const char *tmp;
-#ifdef __USE_GNU
-	cpu_set_t cpuset;
-#endif /* __USE_GNU */
 
 	private = g_new0 (TrackerStorePrivate, 1);
 
@@ -421,21 +394,6 @@ tracker_store_init (void)
 	g_thread_pool_set_max_idle_time (15 * 1000);
 	g_thread_pool_set_max_unused_threads (2);
 
-#ifdef __USE_GNU
-	if (g_getenv ("TRACKER_STORE_DISABLE_CPU_AFFINITY") == NULL) {
-		sched_getcpu ();
-		main_cpu = sched_getcpu ();
-		CPU_ZERO (&cpuset);
-		CPU_SET (main_cpu, &cpuset);
-
-		/* avoid cpu hopping which can lead to significantly worse performance */
-		pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
-		/* lock main update/query thread to same cpu to improve overall performance
-		   main loop thread is essentially idle during query execution */
-		g_thread_pool_push (private->update_pool, GINT_TO_POINTER (1), NULL);
-	}
-#endif /* __USE_GNU */
-
 	g_static_private_set (&private_key,
 	                      private,
 	                      private_free);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]