Changeset: da66e9508dc8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=da66e9508dc8
Modified Files:
gdk/gdk_storage.c
Branch: Aug2011
Log Message:
access_heap: avoid useless call to posix_madvise
On solaris, calling madvise for a region of 0 bytes returns EINVAL.
Makes sense, but resulted in many MT_mmap_inform: posix_madvise failed
messages on the console. Just don't call posix_madvise for nothing.
diffs (28 lines):
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -740,13 +740,17 @@ access_heap(str id, str hp, Heap *h, cha
if (preload > 0) {
size_t alignskip = (page - (((size_t) base) & (page -
1))) & (page - 1);
size_t alignedsz = (size_t) (((sz < alignskip) ? 0 :
((size_t) (sz - alignskip))) & ~(page - 1));
- int ret = posix_madvise(base + alignskip, alignedsz,
adv);
- if (ret)
- THRprintf(GDKerr,
- "#MT_mmap_inform:
posix_madvise(file=%s, base=" PTRFMT ", len=" SZFMT "MB, advice=%s) = %d\n",
- h->filename,
- PTRFMTCAST(base + alignskip),
- alignedsz >> 20, advice, errno);
+ int ret;
+
+ if (alignedsz > 0) {
+ if ((ret = posix_madvise(base + alignskip,
alignedsz, adv)) != 0)
+ THRprintf(GDKerr,
+ "#MT_mmap_inform:
posix_madvise(file=%s, base=" PTRFMT ", len=" SZFMT "MB, advice=%s) = %d, errno
= %d (%s)\n",
+ h->filename,
+ PTRFMTCAST(base + alignskip),
+ alignedsz >> 20, advice, ret,
+ errno, strerror(errno));
+ }
}
}
if (touch && preload > 0 && adv != MMAP_DONTNEED) {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list