lkml.org 
[lkml]   [2015]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4 v6] kernel/fork.c: avoid division by zero

* Oleg Nesterov <oleg@redhat.com> 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 (threads > MAX_THREADS)
> > > >> + threads = MAX_THREADS;
> > > >> +
> > > >> + if (threads < MIN_THREADS)
> > > >> + threads = MIN_THREADS;
>
> clamp(threads, MIN_THREADS, MAX_THREADS)
>
> ;)

Indeed ;-)

Thanks,

Ingo


\
 
 \ /
  Last update: 2015-03-25 13:41    [W:0.039 / U:3.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site