diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-02-25 10:32:52 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-02-25 10:34:57 -0800 |
commit | a507ed6ede5064b8f15c979e54e6de3bb478d73e (patch) | |
tree | e39fa99a4dd25b03b3021769f8a44bc635a79a91 | |
parent | 4624581d53709bc408d5d49e05c04f175bbb62b1 (diff) | |
download | coreutils-a507ed6ede5064b8f15c979e54e6de3bb478d73e.tar.xz |
sort: default to physmem/8, not physmem/16
* src/sort.c (default_sort_size): Don't divide advice by 2.
Just divide the hard limits by 2. This matches the comments.
Reported by Rogier Wolff in http://bugs.gnu.org/10877
-rw-r--r-- | src/sort.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/sort.c b/src/sort.c index 6875a6a93..60ff415cf 100644 --- a/src/sort.c +++ b/src/sort.c @@ -1414,13 +1414,9 @@ default_sort_size (void) struct rlimit rlimit; /* Let SIZE be MEM, but no more than the maximum object size or - system resource limits. Avoid the MIN macro here, as it is not - quite right when only one argument is floating point. Don't - bother to check for values like RLIM_INFINITY since in practice - they are not much less than SIZE_MAX. */ + system resource limits. Don't bother to check for values like + RLIM_INFINITY since in practice they are not much less than SIZE_MAX. */ size_t size = SIZE_MAX; - if (mem < size) - size = mem; if (getrlimit (RLIMIT_DATA, &rlimit) == 0 && rlimit.rlim_cur < size) size = rlimit.rlim_cur; #ifdef RLIMIT_AS @@ -1439,7 +1435,11 @@ default_sort_size (void) size = rlimit.rlim_cur / 16 * 15; #endif - /* Use no less than the minimum. */ + /* Return the minimum of MEM and SIZE, but no less than + MIN_SORT_SIZE. Avoid the MIN macro here, as it is not quite + right when only one argument is floating point. */ + if (mem < size) + size = mem; return MAX (size, MIN_SORT_SIZE); } |