do not attempt to use KSM if it is not available
Costa Tsaousis (ktsaou) committed
Dec 23, 2015 at 20:57 UTC
58ce35f1f5484076516bc573cfa3c02b64417d7b
3 files changed
+10
-31
src/common.c
+4
@@ -122,7 +122,9 @@ void *mymmap(const char *filename, unsigned long size, int flags, int ksm)
122
if(ftruncate(fd, size))
123
error("Cannot truncate file '%s' to size %ld. Will use the larger file.", filename, size);
124
125
+#ifdef MADV_MERGEABLE
126
if(flags & MAP_SHARED || !enable_ksm || !ksm) {
127
+#endif
128
mem = mmap(NULL, size, PROT_READ|PROT_WRITE, flags, fd, 0);
129
if(mem) {
130
int advise = MADV_SEQUENTIAL|MADV_DONTFORK;
@@ -131,6 +133,7 @@ void *mymmap(const char *filename, unsigned long size, int flags, int ksm)
133
if(madvise(mem, size, advise) != 0)
134
error("Cannot advise the kernel about the memory usage of file '%s'.", filename);
135
}
136
+#ifdef MADV_MERGEABLE
137
}
138
else {
139
mem = mmap(NULL, size, PROT_READ|PROT_WRITE, flags|MAP_ANONYMOUS, -1, 0);
@@ -149,6 +152,7 @@ void *mymmap(const char *filename, unsigned long size, int flags, int ksm)
152
else
153
error("Cannot allocate PRIVATE ANONYMOUS memory for KSM for file '%s'.", filename);
154
}
155
+#endif
156
}
157
else error("Cannot write to file '%s' at position %ld.", filename, size);
158
}
src/main.c
+5
@@ -13,6 +13,7 @@
13
#include <sys/wait.h>
14
#include <sys/time.h>
15
#include <sys/resource.h>
16
+#include <sys/mman.h>
17
18
#include "common.h"
19
#include "log.h"
@@ -289,7 +290,11 @@ int main(int argc, char **argv)
290
291
// --------------------------------------------------------------------
292
293
+#ifdef MADV_MERGEABLE
294
enable_ksm = config_get_boolean("global", "memory deduplication (ksm)", enable_ksm);
295
+#else
296
+#warning "Kernel memory deduplication (KSM) is not available"
297
+#endif
298
299
// --------------------------------------------------------------------
300
web/dashboard.css
+1
-31
@@ -272,39 +272,9 @@ html {
272
273
}
274
275
-/* make dygraph legend disappear on hover */
276
-.dygraph-legend {
277
- opacity: 0.9;
278
- -webkit-transition:opacity 0.2s ease;
279
- -moz-transition:opacity 0.2s ease;
280
- -o-transition:opacity 0.2s ease;
281
- padding: 4px;
275
+.dygraph-ylabel {
276
}
277
284
-.dygraph-legend:hover {
285
- /* Red(0-255), Blue(0-255), Green(0-255), Alpha (0-1) */
286
- background-color:rgba(100,100,100,0);
287
- opacity:0;
288
-}
289
-
290
-/* TEST
291
-.dygraph-legend {
292
- position: absolute;
293
- background: rgb(0, 0, 0) transparent !important;
294
- background-color: rgba(0,0,0,0.6) !important;
295
- filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000) !important;
296
- -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)" !important;
297
- color: white !important;
298
- font: 10px arial, san serif !important;
299
- text-align: left !important;
300
- white-space: nowrap !important;
301
- padding: 5px !important;
302
- border: 1px solid white !important;
303
- box-sizing: content-box !important;
304
- z-index: 10000 !important;
305
-}
306
-*/
307
-
278
.dygraph-title {
279
text-indent: 56px;
280
text-align: left;