diff options
author | gabor <gabor@FreeBSD.org> | 2012-12-17 09:36:43 +0000 |
---|---|---|
committer | gabor <gabor@FreeBSD.org> | 2012-12-17 09:36:43 +0000 |
commit | 85e6a5356933034ffa9dafaca845a06cccff90f1 (patch) | |
tree | fe7ec95fbb33c3331d4871eae1a36663c42c84cd /usr.bin | |
parent | 6cbba3065468e4f59f13b2b120cb10da28ea7f8d (diff) | |
download | FreeBSD-src-85e6a5356933034ffa9dafaca845a06cccff90f1.zip FreeBSD-src-85e6a5356933034ffa9dafaca845a06cccff90f1.tar.gz |
- Use unsigned int for values obtained with sysctlbyname(). This fixes
sparc64 performance problems.
Submitted by: Oleg Moskalenko <oleg.moskalenko@citrix.com>
Tested by: trasz
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/sort/sort.c | 11 | ||||
-rw-r--r-- | usr.bin/sort/sort.h | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index 9277de0..2718d64 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -103,7 +103,7 @@ bool debug_sort; bool need_hint; #if defined(SORT_THREADS) -size_t ncpu = 1; +unsigned int ncpu = 1; size_t nthreads = 1; #endif @@ -268,14 +268,16 @@ set_hw_params(void) #if defined(SORT_THREADS) size_t ncpusz; #endif - size_t pages, psize, psz, pszsz; + unsigned int pages, psize; + size_t psz, pszsz; pages = psize = 0; #if defined(SORT_THREADS) ncpu = 1; ncpusz = sizeof(size_t); #endif - psz = pszsz = sizeof(size_t); + psz = sizeof(pages); + pszsz = sizeof(psize); if (sysctlbyname("vm.stats.vm.v_free_count", &pages, &psz, NULL, 0) < 0) { @@ -299,6 +301,9 @@ set_hw_params(void) free_memory = (unsigned long long) pages * (unsigned long long) psize; available_free_memory = (free_memory * 9) / 10; + + if (available_free_memory < 1024) + available_free_memory = 1024; } /* diff --git a/usr.bin/sort/sort.h b/usr.bin/sort/sort.h index f5b48bd..a37f922 100644 --- a/usr.bin/sort/sort.h +++ b/usr.bin/sort/sort.h @@ -54,7 +54,7 @@ extern const char *nlsstr[]; #if defined(SORT_THREADS) #define MT_SORT_THRESHOLD (10000) -extern size_t ncpu; +extern unsigned int ncpu; extern size_t nthreads; #endif |