Re: [PATCH 2/4 v6] kernel/fork.c: avoid division by zero

2015-03-25 Thread Ingo Molnar
* Oleg Nesterov wrote: > On 03/18, Ingo Molnar wrote: > > > > But ... no strong feelings from me, I'm not NAK-ing it or anything, > > maybe I'd have used this well-known pattern: > > > > threads = min(max(MIN_THREADS, threads), MAX_THREADS); > > > > instead of: > > > > > >> + if (thread

Re: [PATCH 2/4 v6] kernel/fork.c: avoid division by zero

2015-03-18 Thread Oleg Nesterov
On 03/18, Ingo Molnar wrote: > > But ... no strong feelings from me, I'm not NAK-ing it or anything, > maybe I'd have used this well-known pattern: > > threads = min(max(MIN_THREADS, threads), MAX_THREADS); > > instead of: > > > >> +if (threads > MAX_THREADS) > > >> +t

Re: [PATCH 2/4 v6] kernel/fork.c: avoid division by zero

2015-03-18 Thread Ingo Molnar
* Heinrich Schuchardt wrote: > On 16.03.2015 08:41, Ingo Molnar wrote: > > > > * Heinrich Schuchardt wrote: > > > >> PAGE_SIZE is not guaranteed to be equal to or less than 8 times the > >> THREAD_SIZE. > >> > >> E.g. architecture hexagon may have page size 1M and thread size 4096. > >> This

Re: [PATCH 2/4 v6] kernel/fork.c: avoid division by zero

2015-03-17 Thread Heinrich Schuchardt
On 16.03.2015 08:41, Ingo Molnar wrote: > > * Heinrich Schuchardt wrote: > >> PAGE_SIZE is not guaranteed to be equal to or less than 8 times the >> THREAD_SIZE. >> >> E.g. architecture hexagon may have page size 1M and thread size 4096. >> This would lead to a division by zero in the calculatio

Re: [PATCH 2/4 v6] kernel/fork.c: avoid division by zero

2015-03-16 Thread Ingo Molnar
* Heinrich Schuchardt wrote: > PAGE_SIZE is not guaranteed to be equal to or less than 8 times the > THREAD_SIZE. > > E.g. architecture hexagon may have page size 1M and thread size 4096. > This would lead to a division by zero in the calculation of max_threads. > > With 32-bit calculation the

[PATCH 2/4 v6] kernel/fork.c: avoid division by zero

2015-03-15 Thread Heinrich Schuchardt
PAGE_SIZE is not guaranteed to be equal to or less than 8 times the THREAD_SIZE. E.g. architecture hexagon may have page size 1M and thread size 4096. This would lead to a division by zero in the calculation of max_threads. With 32-bit calculation there is no solution which delivers valid results