git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Taht <mike.taht@timesys.com>
To: git@vger.kernel.org
Subject: would madvise be a win or a lose on memory pressure?
Date: Fri, 15 Apr 2005 22:05:59 -0700	[thread overview]
Message-ID: <42609D37.3030809@timesys.com> (raw)

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

                 reply	other threads:[~2005-04-16  5:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42609D37.3030809@timesys.com \
    --to=mike.taht@timesys.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).