squashfs/squashfs-thread-limit
Torsten Duwe c65b0a592b Accepting request 402756 from home:duwe:branches:filesystems
- Machines with 1024 processors or more reach the limit of maximum
  file descriptors (bsc#984136). Other limits apply that may be
  hit for no good reason. Simply limit the number of used threads
  to an arbitrary number, squashfs-thread-limit.

OBS-URL: https://build.opensuse.org/request/show/402756
OBS-URL: https://build.opensuse.org/package/show/filesystems/squashfs?expand=0&rev=30
2016-06-16 15:30:32 +00:00

19 lines
827 B
Plaintext

--- squashfs4.3/squashfs-tools/mksquashfs.c.orig 2014-05-13 00:18:20.000000000 +0200
+++ squashfs4.3/squashfs-tools/mksquashfs.c 2016-06-16 17:06:56.347792650 +0200
@@ -4126,6 +4126,15 @@ void initialise_threads(int readq, int f
processors = sysconf(_SC_NPROCESSORS_ONLN);
#endif
}
+ /* Every frag_thrd will:
+ * * occupy a slot in the process table (_SC_CHILD_MAX), and will
+ * * allocate SQUASHFS_FILE_MAX_SIZE (currently 1MiB), which is
+ * accounted towards the per-process datasize limit, and will
+ * * open 1 file descriptor (_SC_OPEN_MAX).
+ * Before we hit any of those limits on big irons, limit
+ * ourselves to an impressive but sane arbitrary maximum.
+ */
+ if (processors > 64) processors = 64;
if(multiply_overflow(processors, 3) ||
multiply_overflow(processors * 3, sizeof(pthread_t)))