svn commit: r244346 - head/usr.bin/sort
Gabor Kovesdan
gabor at FreeBSD.org
Mon Dec 17 09:36:44 UTC 2012
Author: gabor
Date: Mon Dec 17 09:36:43 2012
New Revision: 244346
URL: http://svnweb.freebsd.org/changeset/base/244346
Log:
- Use unsigned int for values obtained with sysctlbyname(). This fixes
sparc64 performance problems.
Submitted by: Oleg Moskalenko <oleg.moskalenko at citrix.com>
Tested by: trasz
Modified:
head/usr.bin/sort/sort.c
head/usr.bin/sort/sort.h
Modified: head/usr.bin/sort/sort.c
==============================================================================
--- head/usr.bin/sort/sort.c Mon Dec 17 06:44:16 2012 (r244345)
+++ head/usr.bin/sort/sort.c Mon Dec 17 09:36:43 2012 (r244346)
@@ -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;
}
/*
Modified: head/usr.bin/sort/sort.h
==============================================================================
--- head/usr.bin/sort/sort.h Mon Dec 17 06:44:16 2012 (r244345)
+++ head/usr.bin/sort/sort.h Mon Dec 17 09:36:43 2012 (r244346)
@@ -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
More information about the svn-src-all
mailing list