trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1180492 - in /trafficserver/traffic/trunk: configure.ac lib/ts/ink_config.h.in lib/ts/ink_queue.cc
Date Sat, 08 Oct 2011 21:24:34 GMT
Author: zwoop
Date: Sat Oct  8 21:24:33 2011
New Revision: 1180492

URL: http://svn.apache.org/viewvc?rev=1180492&view=rev
Log:
TS-567 Add --disable-freelist, finally

Modified:
    trafficserver/traffic/trunk/configure.ac
    trafficserver/traffic/trunk/lib/ts/ink_config.h.in
    trafficserver/traffic/trunk/lib/ts/ink_queue.cc

Modified: trafficserver/traffic/trunk/configure.ac
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/configure.ac?rev=1180492&r1=1180491&r2=1180492&view=diff
==============================================================================
--- trafficserver/traffic/trunk/configure.ac (original)
+++ trafficserver/traffic/trunk/configure.ac Sat Oct  8 21:24:33 2011
@@ -384,6 +384,21 @@ AC_ARG_ENABLE([tproxy],
 AC_MSG_RESULT([$enable_tproxy])
 
 #
+# Disable our freelist implementation, reverting it to whatever
+# allocator (malloc, tcmalloc or jemalloc) that is in use. This is
+# useful for debugging.
+#
+AC_MSG_CHECKING([whether to disable freelist])
+AC_ARG_ENABLE([freelist],
+  [AS_HELP_STRING([--disable-freelist],[turn off freelist and use allocators])],
+  [],
+  [enable_freelist="yes"]
+)
+AC_MSG_RESULT([$enable_freelist])
+TS_ARG_ENABLE_VAR([use], [freelist])
+AC_SUBST(use_freelist)
+
+#
 # Configure how many stats to allocate for plugins. Default is 512.
 #
 AC_ARG_WITH([max-api-stats],

Modified: trafficserver/traffic/trunk/lib/ts/ink_config.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_config.h.in?rev=1180492&r1=1180491&r2=1180492&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_config.h.in (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_config.h.in Sat Oct  8 21:24:33 2011
@@ -109,12 +109,13 @@
 #define TS_USE_POSIX_CAP               @use_posix_cap@
 #define TS_USE_TPROXY                  @use_tproxy@
 #define TS_USE_HWLOC                   @use_hwloc@
+#define TS_USE_FREELIST                @use_freelist@
 
 /* OS API definitions */
-#define GETHOSTBYNAME_R_HOSTENT_DATA    @gethostbyname_r_hostent_data@
-#define GETHOSTBYNAME_R_GLIBC2          @gethostbyname_r_glibc2@
-#define NEED_UNION_SEMUN                @need_union_semun@
-#define SIZEOF_VOID_POINTER             @ac_cv_sizeof_voidp@
+#define GETHOSTBYNAME_R_HOSTENT_DATA   @gethostbyname_r_hostent_data@
+#define GETHOSTBYNAME_R_GLIBC2         @gethostbyname_r_glibc2@
+#define NEED_UNION_SEMUN               @need_union_semun@
+#define SIZEOF_VOID_POINTER            @ac_cv_sizeof_voidp@
 #define TS_IP_TRANSPARENT              @ip_transparent@
 
 /* API */

Modified: trafficserver/traffic/trunk/lib/ts/ink_queue.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_queue.cc?rev=1180492&r1=1180491&r2=1180492&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_queue.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_queue.cc Sat Oct  8 21:24:33 2011
@@ -150,6 +150,7 @@ int fastmemtotal = 0;
 void *
 ink_freelist_new(InkFreeList * f)
 {
+#if TS_USE_FREELIST
   head_p item;
   head_p next;
   int result = 0;
@@ -234,12 +235,22 @@ ink_freelist_new(InkFreeList * f)
   ink_atomic_increment64(&fastalloc_mem_in_use, (int64_t) f->type_size);
 
   return TO_PTR(FREELIST_POINTER(item));
+#else // ! TS_USE_FREELIST
+  void *newp = NULL;
+
+  if (f->alignment)
+    newp = ats_memalign(f->alignment, f->chunk_size * f->type_size);
+  else
+    newp = ats_malloc(f->chunk_size * f->type_size);
+  return newp;
+#endif
 }
 typedef volatile void *volatile_void_p;
 
 void
 ink_freelist_free(InkFreeList * f, void *item)
 {
+#if TS_USE_FREELIST
   volatile_void_p *adr_of_next = (volatile_void_p *) ADDRESS_OF_NEXT(item, f->offset);
   head_p h;
   head_p item_pair;
@@ -277,11 +288,18 @@ ink_freelist_free(InkFreeList * f, void 
 
   ink_atomic_increment((int *) &f->count, -1);
   ink_atomic_increment64(&fastalloc_mem_in_use, -(int64_t) f->type_size);
+#else
+  if (f->alignment)
+    ats_memalign_free(item);
+  else
+    ats_free(item);
+#endif
 }
 
 void
 ink_freelists_snap_baseline()
 {
+#if TS_USE_FREELIST
   ink_freelist_list *fll;
   fll = freelists;
   while (fll) {
@@ -289,11 +307,15 @@ ink_freelists_snap_baseline()
     fll->fl->count_base = fll->fl->count;
     fll = fll->next;
   }
+#else // ! TS_USE_FREELIST
+  // TODO?
+#endif
 }
 
 void
 ink_freelists_dump_baselinerel(FILE * f)
 {
+#if TS_USE_FREELIST
   ink_freelist_list *fll;
   if (f == NULL)
     f = stderr;
@@ -313,11 +335,15 @@ ink_freelists_dump_baselinerel(FILE * f)
     }
     fll = fll->next;
   }
+#else // ! TS_USE_FREELIST
+  // TODO?
+#endif
 }
 
 void
 ink_freelists_dump(FILE * f)
 {
+#if TS_USE_FREELIST
   ink_freelist_list *fll;
   if (f == NULL)
     f = stderr;
@@ -332,12 +358,12 @@ ink_freelists_dump(FILE * f)
             (uint64_t)fll->fl->count * (uint64_t)fll->fl->type_size, fll->fl->type_size,
fll->fl->name ? fll->fl->name : "<unknown>");
     fll = fll->next;
   }
+#else // ! TS_USE_FREELIST
+  // TODO?
+#endif
 }
 
 
-#define INK_FREELIST_CREATE(T, n) \
-ink_freelist_create("<unknown>", sizeof(T), n, (uintptr_t)&((T *)0)->next, 4)
-
 void
 ink_atomiclist_init(InkAtomicList * l, const char *name, uint32_t offset_to_next)
 {



Mime
View raw message