trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrushf...@apache.org
Subject [trafficserver] branch master updated: TS-4957: Make the use of madvise() with MADV_DONTDUMP configurable.
Date Wed, 19 Oct 2016 16:44:12 GMT
This is an automated email from the ASF dual-hosted git repository.

jrushford pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  514d3fd   TS-4957: Make the use of madvise() with MADV_DONTDUMP configurable.
514d3fd is described below

commit 514d3fd7de5841b8a74cd32bed001db9b479764f
Author: John J. Rushford <jrushford@apache.org>
AuthorDate: Tue Oct 11 21:37:01 2016 +0000

    TS-4957: Make the use of madvise() with MADV_DONTDUMP configurable.
---
 doc/admin-guide/files/records.config.en.rst |  6 ++++++
 iocore/eventsystem/EventSystem.cc           | 13 ++++++++++++-
 iocore/eventsystem/IOBuffer.cc              |  9 ++-------
 iocore/eventsystem/I_IOBuffer.h             |  2 +-
 mgmt/RecordsConfig.cc                       |  2 ++
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 3f7d3b5..da887d5 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -3547,6 +3547,12 @@ Sockets
    For more information on the implications of enabling huge pages, see
    `Wikipedia <http://en.wikipedia.org/wiki/Page_%28computer_memory%29#Page_size_trade-off>_`.
 
+.. ts:cv:: CONFIG proxy.config.allocator.dontdump_iobuffers INT 1
+
+  Enable (1) the exclusion of IO buffers from core files when ATS crashes on supported
+  platforms.  (Currently only linux).  IO buffers are allocated with the MADV_DONTDUMP 
+  with madvise() on linux platforms that support MADV_DONTDUMP.  Enabled by default.
+
 .. ts:cv:: CONFIG proxy.config.http.enabled INT 1
 
    Turn on or off support for HTTP proxying. This is rarely used, the one
diff --git a/iocore/eventsystem/EventSystem.cc b/iocore/eventsystem/EventSystem.cc
index d63440b..1cb3613 100644
--- a/iocore/eventsystem/EventSystem.cc
+++ b/iocore/eventsystem/EventSystem.cc
@@ -35,6 +35,7 @@ ink_event_system_init(ModuleVersion v)
 {
   ink_release_assert(!checkModuleVersion(v, EVENT_SYSTEM_MODULE_VERSION));
   int config_max_iobuffer_size = DEFAULT_MAX_BUFFER_SIZE;
+  int iobuffer_advice          = 0;
 
   // For backwards compatability make sure to allow thread_freelist_size
   // This needs to change in 6.0
@@ -51,5 +52,15 @@ ink_event_system_init(ModuleVersion v)
   if (default_large_iobuffer_size > max_iobuffer_size) {
     default_large_iobuffer_size = max_iobuffer_size;
   }
-  init_buffer_allocators();
+
+#ifdef MADV_DONTDUMP // This should only exist on Linux 3.4 and higher.
+  RecBool dont_dump_enabled = true;
+  RecGetRecordBool("proxy.config.allocator.dontdump_iobuffers", &dont_dump_enabled, false);
+
+  if (dont_dump_enabled) {
+    iobuffer_advice |= MADV_DONTDUMP;
+  }
+#endif
+
+  init_buffer_allocators(iobuffer_advice);
 }
diff --git a/iocore/eventsystem/IOBuffer.cc b/iocore/eventsystem/IOBuffer.cc
index 1efb8af..c2aa910 100644
--- a/iocore/eventsystem/IOBuffer.cc
+++ b/iocore/eventsystem/IOBuffer.cc
@@ -43,14 +43,9 @@ int64_t max_iobuffer_size           = DEFAULT_BUFFER_SIZES - 1;
 // Initialization
 //
 void
-init_buffer_allocators()
+init_buffer_allocators(int iobuffer_advice)
 {
   char *name;
-  int advice = 0;
-
-#ifdef MADV_DONTDUMP // This should only exist on Linux 3.4 and higher.
-  advice = MADV_DONTDUMP;
-#endif
 
   for (int i = 0; i < DEFAULT_BUFFER_SIZES; i++) {
     int64_t s = DEFAULT_BUFFER_BASE_SIZE * (((int64_t)1) << i);
@@ -61,7 +56,7 @@ init_buffer_allocators()
 
     name = new char[64];
     snprintf(name, 64, "ioBufAllocator[%d]", i);
-    ioBufAllocator[i].re_init(name, s, n, a, advice);
+    ioBufAllocator[i].re_init(name, s, n, a, iobuffer_advice);
   }
 }
 
diff --git a/iocore/eventsystem/I_IOBuffer.h b/iocore/eventsystem/I_IOBuffer.h
index 26414ab..e071775 100644
--- a/iocore/eventsystem/I_IOBuffer.h
+++ b/iocore/eventsystem/I_IOBuffer.h
@@ -125,7 +125,7 @@ enum AllocType {
 
 inkcoreapi extern Allocator ioBufAllocator[DEFAULT_BUFFER_SIZES];
 
-void init_buffer_allocators();
+void init_buffer_allocators(int iobuffer_advice);
 
 /**
   A reference counted wrapper around fast allocated or malloced memory.
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index f6183c3..4f8d4bc 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1454,6 +1454,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.allocator.hugepages", RECD_INT, "0", RECU_RESTART_TS, RR_NULL,
RECC_NULL, "[0-1]", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.allocator.dontdump_iobuffers", RECD_INT, "1", RECU_RESTART_TS,
RR_NULL, RECC_NULL, "[0-1]", RECA_NULL}
+  ,
 
   //############
   //#

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message