public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ильфат Гаптрахманов" <i.gaptrakhmanov@rosalinux.ru>
To: "Matthew Wilcox" <willy@infradead.org>,
	"Михаил Новоселов" <m.novosyolov@rosalinux.ru>
Cc: riel@surriel.com, mgorman@techsingularity.net,
	peterz@infradead.org, mingo@kernel.org,
	akpm@linux-foundation.org, stable@vger.kernel.org,
	sashal@kernel.org, "Бетхер Александр" <a.betkher@rosalinux.ru>
Subject: Re: Serious regression on 6.1.x-stable caused by "bounds: support non-power-of-two CONFIG_NR_CPUS"
Date: Mon, 29 Apr 2024 16:37:43 +0300	[thread overview]
Message-ID: <79ac00a0-4107-bf1a-00c2-07ade9a7791e@rosalinux.ru> (raw)
In-Reply-To: <Zi-P2rrWZTlrpi3B@casper.infradead.org>

29.04.2024 15:17, Matthew Wilcox пишет:
> CONFIG_NR_CPUS=8192
>
> Since you're using a power-of-two, this should have been a no-op.
> But bits_per() doesn't work the way I thought it did!
>
> #define bits_per(n)                             \
> (                                               \
>          __builtin_constant_p(n) ? (             \
>                  ((n) == 0 || (n) == 1)          \
>                          ? 1 : ilog2(n) + 1      \
>          ) :                                     \
>
> CONFIG_NR_CPUS is obviously a constant, and larger than 1, so we end up
> calling ilog2(n) + 1.  So we allocate one extra bit.
>
> I should have changed this to
> DEFINE(NR_CPUS_BITS, bits_per(CONFIG_NR_CPUS - 1))
>
> Can you test that and report back?  I'll prepare a fix for mainline in
> the meantime.
Yes, this fix solved the problem

      reply	other threads:[~2024-04-29 13:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28 14:58 Serious regression on 6.1.x-stable caused by "bounds: support non-power-of-two CONFIG_NR_CPUS" Mikhail Novosyolov
2024-04-29  2:56 ` Matthew Wilcox
2024-04-29  4:07   ` Михаил Новоселов
2024-04-29 12:17     ` Matthew Wilcox
2024-04-29 13:37       ` Ильфат Гаптрахманов [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79ac00a0-4107-bf1a-00c2-07ade9a7791e@rosalinux.ru \
    --to=i.gaptrakhmanov@rosalinux.ru \
    --cc=a.betkher@rosalinux.ru \
    --cc=akpm@linux-foundation.org \
    --cc=m.novosyolov@rosalinux.ru \
    --cc=mgorman@techsingularity.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox