diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-07-02 14:30:24 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-07-02 15:02:11 +0300 |
commit | bf3a14a86682e4bf341eed4d6d7050ef57b1ccc2 (patch) | |
tree | 16ce69b5a7b2813f64b0012b6947e7fce40c948b /rpmio | |
parent | 105f91fc9a0afd9f8d29491c909833bdf2228f8a (diff) | |
download | librpm-tizen-bf3a14a86682e4bf341eed4d6d7050ef57b1ccc2.tar.gz librpm-tizen-bf3a14a86682e4bf341eed4d6d7050ef57b1ccc2.tar.bz2 librpm-tizen-bf3a14a86682e4bf341eed4d6d7050ef57b1ccc2.zip |
Dont use mmap() for anything, axe the code instead
- Commit 4cb02aa928d3e41f636d0e01356c7a3cb51018ee asked to see
what breaks when mmap() is used, now we know: large package support
broke when enabling it. Could be fixed of course by eg adding
a size cap to the fsm part as well, but just doesn't seem worth it:
I fail to measure any meaningful performance improvement from mmap
usage in either case, and added complexity for what is close to
zero benefit just doesn't make sense... and various sources in fact
note the rpm usage (read through the entire file sequentially) as one
of the cases where mmap() is NOT beneficial due to mmap() high
setup + teardown cost + page fault speed (or lack of thereof).
Diffstat (limited to 'rpmio')
-rw-r--r-- | rpmio/rpmfileutil.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c index bb84bc1ee..6cdfe2552 100644 --- a/rpmio/rpmfileutil.c +++ b/rpmio/rpmfileutil.c @@ -13,10 +13,6 @@ #endif -#if defined(HAVE_MMAP) -#include <sys/mman.h> -#endif - #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> @@ -154,43 +150,9 @@ int rpmDoDigest(int algo, const char * fn,int asAscii, goto exit; } - /* file to large (32 MB), do not mmap file */ - if (fsize > (size_t) 32*1024*1024) - if (ut == URL_IS_PATH || ut == URL_IS_UNKNOWN) - ut = URL_IS_DASH; /* force fd io */ - switch(ut) { case URL_IS_PATH: case URL_IS_UNKNOWN: -#ifdef HAVE_MMAP - if (pid == 0) { - int xx; - DIGEST_CTX ctx; - void * mapped; - - if (fsize) { - mapped = mmap(NULL, fsize, PROT_READ, MAP_SHARED, fdno, 0); - if (mapped == MAP_FAILED) { - xx = close(fdno); - rc = 1; - break; - } - -#ifdef MADV_SEQUENTIAL - xx = madvise(mapped, fsize, MADV_SEQUENTIAL); -#endif - } - - ctx = rpmDigestInit(algo, RPMDIGEST_NONE); - if (fsize) - xx = rpmDigestUpdate(ctx, mapped, fsize); - xx = rpmDigestFinal(ctx, (void **)&dig, &diglen, asAscii); - if (fsize) - xx = munmap(mapped, fsize); - xx = close(fdno); - break; - } -#endif case URL_IS_HTTPS: case URL_IS_HTTP: case URL_IS_FTP: |