derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e2875cefc49768f919919fbfa478f81570168688

commit e2875cefc49768f919919fbfa478f81570168688
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Tue Sep 20 11:33:33 2016 -0500

    eina_cpu, evas: Remove _eina_cpu_fast_core_get, don't set render thread 
affinity
    
    We've decided it would be best to just let the scheduler do its job.
---
 src/Makefile_Eina.am                     |   1 -
 src/lib/eina/eina_cpu.c                  | 117 -------------------------------
 src/lib/eina/eina_cpu_private.h          |  42 -----------
 src/lib/evas/common/evas_thread_render.c |  13 +---
 4 files changed, 2 insertions(+), 171 deletions(-)

diff --git a/src/Makefile_Eina.am b/src/Makefile_Eina.am
index 96ff376..22ade8f 100644
--- a/src/Makefile_Eina.am
+++ b/src/Makefile_Eina.am
@@ -58,7 +58,6 @@ lib/eina/eina_trash.h \
 lib/eina/eina_iterator.h \
 lib/eina/eina_main.h \
 lib/eina/eina_cpu.h \
-lib/eina/eina_cpu_private.h \
 lib/eina/eina_inline_cpu.x \
 lib/eina/eina_sched.h \
 lib/eina/eina_tiler.h \
diff --git a/src/lib/eina/eina_cpu.c b/src/lib/eina/eina_cpu.c
index 9f4ab4b..3ec9204 100644
--- a/src/lib/eina/eina_cpu.c
+++ b/src/lib/eina/eina_cpu.c
@@ -49,25 +49,12 @@
 #include "eina_log.h"
 #include "eina_cpu.h"
 
-#include <Eina.h>
-
-#include "eina_cpu_private.h"
-
-#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_ASM_HWCAP_H) && defined(__arm__) 
&& defined(__linux__)
-# include <sys/auxv.h>
-# include <asm/hwcap.h>
-#endif
-
 /*============================================================================*
 *                                  Local                                     *
 *============================================================================*/
 
 static void _eina_page_size(void);
 
-static int fastest_core_speed = 0;
-static int slowest_core_speed = INT_MAX;
-static Eina_Hash *cpu_hash = NULL;
-
 /* FIXME this ifdefs should be replaced */
 #if defined(__i386__) || defined(__x86_64__)
 /* We save ebx and restore it to be PIC compatible */
@@ -178,9 +165,6 @@ eina_cpu_init(void)
 Eina_Bool
 eina_cpu_shutdown(void)
 {
-   eina_hash_free(cpu_hash);
-   cpu_hash = NULL;
-   fastest_core_speed = 0;
    return EINA_TRUE;
 }
 
@@ -316,104 +300,3 @@ void eina_cpu_count_internal(void)
    else
      _cpu_count = _eina_cpu_count_internal();
 }
-
-static void
-eina_cpu_map_init(void)
-{
-   fastest_core_speed = -1;
-
-#if defined (__linux__) || defined(__GLIBC__)
-   FILE *f = NULL;
-   Eina_Iterator *it;
-   Eina_Strbuf *fname;
-   const Eina_File_Direct_Info *f_info;
-
-   it = eina_file_stat_ls("/sys/devices/system/cpu/cpufreq");
-   if (!it) return;
-
-   cpu_hash = eina_hash_int32_new(free);
-
-   fname = eina_strbuf_new();
-   EINA_ITERATOR_FOREACH(it, f_info)
-     {
-        if ((f_info->type == EINA_FILE_DIR) &&
-            eina_str_has_prefix(f_info->path,
-                                "/sys/devices/system/cpu/cpufreq/policy"))
-          {
-             int num, speed;
-
-             eina_strbuf_append_printf(fname, "%s%s", f_info->path, 
"/cpuinfo_max_freq");
-             f = fopen(eina_strbuf_string_get(fname), "r");
-             eina_strbuf_reset(fname);
-             if (!f) goto err;
-             speed = -1;
-             num = fscanf(f, "%d", &speed);
-             fclose(f);
-             f = NULL;
-             if ((num != 1) || (speed == -1)) goto err;
-
-             slowest_core_speed = MIN(speed, slowest_core_speed);
-             fastest_core_speed = MAX(speed, fastest_core_speed);
-
-             eina_strbuf_append_printf(fname, "%s%s", f_info->path, 
"/affected_cpus");
-             f = fopen(eina_strbuf_string_get(fname), "r");
-             eina_strbuf_reset(fname);
-             if (!f) goto err;
-             do
-               {
-                  int core;
-                  uint64_t *corelist;
-                  num = fscanf(f, "%d", &core);
-                  if ((num == EOF) || (core > 63)) break;
-
-                  corelist = eina_hash_find(cpu_hash, &speed);
-                  if (!corelist)
-                    {
-                       corelist = malloc(sizeof(*corelist));
-                       if (!corelist) goto err;
-                       *corelist = 1LL << core;
-                       eina_hash_add(cpu_hash, &speed, corelist);
-                    }
-                  *corelist |= 1LL << core;
-               } while (num != EOF);
-             fclose(f);
-             f = NULL;
-          }
-     }
-err:
-   if (f) fclose(f);
-   eina_strbuf_free(fname);
-   eina_iterator_free(it);
-#endif
-}
-
-EAPI int
-_eina_cpu_fast_core_get(void)
-{
-#if defined (__linux__) || defined(__GLIBC__)
-   uint64_t *corelist;
-   uint64_t cores;
-   int bit, place = 0;
-
-   if (fastest_core_speed == -1) return -1;
-
-   if (fastest_core_speed == 0) eina_cpu_map_init();
-
-   /* Check again now that it's actually set up */
-   if (fastest_core_speed == -1) return -1;
-
-   corelist = eina_hash_find(cpu_hash, &fastest_core_speed);
-   cores = *corelist;
-   bit = rand() % __builtin_popcount(cores);
-   while (bit || !(cores & 1))
-     {
-        if (cores & 1) bit--;
-        cores = cores >> 1;
-        place++;
-     }
-
-   return place;
-#else
-   return 0;
-#endif
-}
diff --git a/src/lib/eina/eina_cpu_private.h b/src/lib/eina/eina_cpu_private.h
deleted file mode 100644
index e114b01..0000000
--- a/src/lib/eina/eina_cpu_private.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef EINA_CPU_PRIVATE_H_
-#define EINA_CPU_PRIVATE_H_
-
-#ifdef EAPI
-# undef EAPI
-#endif
-
-#ifdef _WIN32
-# ifdef EFL_EINA_BUILD
-#  ifdef DLL_EXPORT
-#   define EAPI __declspec(dllexport)
-#  else
-#   define EAPI
-#  endif /* ! DLL_EXPORT */
-# else
-#  define EAPI __declspec(dllimport)
-# endif /* ! EFL_EINA_BUILD */
-# define EAPI_WEAK
-#else
-# ifdef __GNUC__
-#  if __GNUC__ >= 4
-#   define EAPI __attribute__ ((visibility("default")))
-#   define EAPI_WEAK __attribute__ ((weak))
-#  else
-#   define EAPI
-#   define EAPI_WEAK
-#  endif
-# else
-/**
- * @def EAPI
- * @brief Used to export functions(by changing visibility).
- */
-#  define EAPI
-# endif
-#endif
-
-EAPI int _eina_cpu_fast_core_get(void);
-
-#undef EAPI
-#define EAPI
-
-#endif
diff --git a/src/lib/evas/common/evas_thread_render.c 
b/src/lib/evas/common/evas_thread_render.c
index 3489c5a..99c6b95 100644
--- a/src/lib/evas/common/evas_thread_render.c
+++ b/src/lib/evas/common/evas_thread_render.c
@@ -1,5 +1,4 @@
 #include "evas_common_private.h"
-#include "eina_cpu_private.h"
 
 #include <assert.h>
 
@@ -126,7 +125,6 @@ out:
 void
 evas_thread_init(void)
 {
-    int core;
     if (init_count++) return;
 
     eina_threads_init();
@@ -138,16 +136,9 @@ evas_thread_init(void)
     if (!eina_condition_new(&evas_thread_queue_condition, 
&evas_thread_queue_lock))
       CRI("Could not create draw thread condition");
 
-    core = _eina_cpu_fast_core_get();
-    /* Keep previous behaviour of pinning to core 0 if finding a fast
-     * core fails.
-     */
-    if (core < 0) core = 0;
-    if (!eina_thread_create(&evas_thread_worker, EINA_THREAD_NORMAL, core,
+    if (!eina_thread_create(&evas_thread_worker, EINA_THREAD_NORMAL, -1,
           evas_thread_worker_func, NULL))
-      if (!eina_thread_create(&evas_thread_worker, EINA_THREAD_NORMAL, -1,
-            evas_thread_worker_func, NULL))
-        CRI("Could not create draw thread");
+      CRI("Could not create draw thread");
 }
 
 void

-- 


Reply via email to