Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Martin KaFai Lau <kafai@fb.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Linux-Sparse <linux-sparse@vger.kernel.org>,
	Arthur Fabre <afabre@cloudflare.com>
Subject: Re: sparse problem with Linux kernel v5.5
Date: Fri, 7 Feb 2020 11:35:49 +0100	[thread overview]
Message-ID: <20200207103549.lhfxdi6e57v7cvor@ltop.local> (raw)
In-Reply-To: <20200207003434.klmw4vuwbrkv7ykt@kafai-mbp>

On Thu, Feb 06, 2020 at 04:34:34PM -0800, Martin KaFai Lau wrote:
> On Thu, Feb 06, 2020 at 03:47:21PM -0800, Linus Torvalds wrote:
> > 
> > Instead, it could just calculate the nbuckets first, and then do the
> > "log2()" on that:
> > 
> >         /* Use at least 2 buckets, select_bucket() is undefined
> > behavior with 1 bucket */
> >         nbuckets = max_t(u32, 2, roundup_pow_of_two(num_possible_cpus()));
> >         smap->bucket_log = ilog2(buckets);
> > 
> > because honestly, that is just a whole lot more legible anyway. Maybe
> > even split _that_ up, and have the max_t as a separate thing.
> Thanks for the suggestion.  I can post a patch for this.

There is also order_base_2() which,  I think, does exactly what you
need and shouldn't have the current problem.

-- Luc 

  reply	other threads:[~2020-02-07 10:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06  4:49 sparse problem with Linux kernel v5.5 Randy Dunlap
2020-02-06  4:58 ` Randy Dunlap
2020-02-06  7:18 ` Linus Torvalds
2020-02-06 11:46   ` Luc Van Oostenryck
2020-02-06 18:25     ` Randy Dunlap
2020-02-06 20:06       ` Luc Van Oostenryck
2020-02-06 23:47         ` Linus Torvalds
2020-02-07  0:34           ` Martin KaFai Lau
2020-02-07 10:35             ` Luc Van Oostenryck [this message]
2020-02-07  6:34           ` Uwe Kleine-König
2020-02-07  8:29             ` Martin KaFai Lau
2020-02-07 11:34               ` Uwe Kleine-König
2020-02-07 12:43                 ` Luc Van Oostenryck
2020-02-07 10:31           ` Luc Van Oostenryck

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=20200207103549.lhfxdi6e57v7cvor@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=afabre@cloudflare.com \
    --cc=ast@kernel.org \
    --cc=kafai@fb.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=torvalds@linux-foundation.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