[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHk-=whEMvpPLrzsi6BoH=o+-ScRKuuqxrdWSnrTtGEi=JvcNA@mail.gmail.com>
Date: Mon, 29 Apr 2024 08:32:39 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc: linux-kernel@...r.kernel.org,
Михаил Новоселов <m.novosyolov@...alinux.ru>,
Ильфат Гаптрахманов <i.gaptrakhmanov@...alinux.ru>,
stable@...r.kernel.org, Rik van Riel <riel@...riel.com>,
Mel Gorman <mgorman@...hsingularity.net>, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] bounds: Use the right number of bits for power-of-two CONFIG_NR_CPUS
On Mon, 29 Apr 2024 at 07:48, Matthew Wilcox (Oracle)
<willy@...radead.org> wrote:
>
> bits_per() rounds up to the next power of two when passed a power of
> two. This causes crashes on some machines and configurations.
Bah. Your patch is *still* wrong, because bits_per() thinks you need
one bit for a zero value, so when you do
bits_per(CONFIG_NR_CPUS - 1)
and some insane person has enabled SMP and managed to set
CONFIG_NR_CPUS to 1, the math is *still* broken.
The right thing to do is
order_base_2(CONFIG_NR_CPUS)
and 'bits_per()' should be avoided, having completely crazy semantics
(you can tell how almost all users actually do "x-1" as the argument).
We should probably get rid of that horrid bits_per(() entirely.
I applied your patch with that fixed (which admittedly make it all
*my* patch, but applying it as yours just to get the changelog).
Linus
Powered by blists - more mailing lists