[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7a34c010-9f2a-431b-3c49-8f0d387f1cba@redhat.com>
Date: Fri, 28 May 2021 15:08:59 +0200
From: David Hildenbrand <david@...hat.com>
To: torvic9@...lbox.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: Re: [Question] mm/vmpressure.c: ilog2 calculation in constant
On 28.05.21 14:08, torvic9@...lbox.org wrote:
> Hello,
>
> in mm/vmpressure.c, we have defined this constant:
>
> static const unsigned int vmpressure_level_critical_prio = ilog2(100 / 10);
>
> My question is: Why do we calculate ilog2 instead of simply setting the constant to '3'?
My best guess is that it's in place to a) increase readability b) make
it easier to adjust. The compiler will optimize it out either way, so we
don't really care.
Having that said: it doesn't increase readability on my end. But I only
took a quick glimpse. Maybe the "100 / 10 == 10" here is the magic bit
also mentioned in the comment "when scanning depth is ~10%". So it can
be adjusted "more easily" eventually ... at least not by me.
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists