From 8e81a99c2690a5a8e3a3449e9c4f440738e0cac9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 16 Dec 2010 22:31:56 -0800 Subject: sort: do not generate thousands of subprocesses for 16-way merge Without this change, tests/misc/sort-compress-hang would consume more than 10,000 process slots on my RHEL 5.5 x86-64 server, making it likely for other applications to fail due to lack of process slots. With this change, the same benchmark causes 'sort' to consume at most 19 process slots. The change also improved wall-clock time by 2% and user+system time by 14% on that benchmark. * NEWS: Document this. * src/sort.c (MAX_PROCS_BEFORE_REAP): Remove. (reap_exited): Renamed from reap_some; this is a more accurate name, since "some" incorrectly implies that it reaps at least one process. All uses changed. (reap_some): New function: it *does* reap at least one process. (pipe_fork): Do not allow more than NMERGE + 2 subprocesses. (mergefps, sort): Omit check for exited processes: no longer needed, and anyway the code consumed too much CPU per line when 2 < nprocs. --- NEWS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'NEWS') diff --git a/NEWS b/NEWS index a69ef5460..484ed5ccc 100644 --- a/NEWS +++ b/NEWS @@ -22,7 +22,8 @@ GNU coreutils NEWS -*- outline -*- into the stack of an expired thread. [bug introduced in coreutils-8.6] sort --compress no longer mishandles subprocesses' exit statuses, - and no longer hangs indefinitely due to a bug in waiting for subprocesses. + no longer hangs indefinitely due to a bug in waiting for subprocesses, + and no longer generates many more than NMERGE subprocesses. sort -m -o f f ... f no longer dumps core when file descriptors are limited. -- cgit v1.2.3-70-g09d2