* would madvise be a win or a lose on memory pressure?
@ 2005-04-16 5:05 Mike Taht
0 siblings, 0 replies; only message in thread
From: Mike Taht @ 2005-04-16 5:05 UTC (permalink / raw)
To: git
Doesn't seem to make sense to use MADV_RANDOM on the cache file, but
maybe MADV_SEQUENTIAL on the rest...
--- /home/m/src/git-pasky-0.4/update-cache.c 2005-04-15
12:24:26.000000000 -0700
+++ update-cache.c 2005-04-15 21:53:34.000000000 -0700
@@ -30,7 +30,7 @@
close(fd);
if (!out || (int)(long)in == -1)
return -1;
-
+ madvise(in,size,MADV_SEQUENTIAL);
memset(&stream, 0, sizeof(stream));
deflateInit(&stream, Z_BEST_COMPRESSION);
--- /home/m/src/git-pasky-0.4/read-cache.c 2005-04-15
12:24:26.000000000 -0700
+++ read-cache.c 2005-04-15 22:01:12.000000000 -0700
@@ -143,6 +143,7 @@
close(fd);
if (-1 == (int)(long)map)
return NULL;
+ madvise(map,st.st_size,MADV_SEQUENTIAL);
*size = st.st_size;
return map;
}
@@ -254,6 +255,7 @@
close(fd);
if (map == MAP_FAILED)
return -1;
+ madvise(map,size,MADV_SEQUENTIAL);
cmp = memcmp(buf, map, size);
munmap(map, size);
if (cmp)
--
Mike Taht
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-16 5:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-16 5:05 would madvise be a win or a lose on memory pressure? Mike Taht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.