mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Antonio Vargas <wind@cocodriloo.com>
To: Thomas Schlichter <schlicht@uni-mannheim.de>
Cc: Jes Sorensen <jes@wildopensource.com>,
	William Lee Irwin III <wli@holomorphy.com>,
	Alexander Viro <viro@math.psu.edu>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, jbarnes@sgi.com, steiner@sgi.com
Subject: Re: hash table sizes
Date: Tue, 25 Nov 2003 18:52:15 +0100	[thread overview]
Message-ID: <20031125175215.GB30083@wind.cocodriloo.com> (raw)
In-Reply-To: <200311251725.07573.schlicht@uni-mannheim.de>

On Tue, Nov 25, 2003 at 05:25:07PM +0100, Thomas Schlichter wrote:
> Hi Jens,
> 
> I was wondering about you funny formula, too. (especially because it was 23 - 
> (PAGE_SHIFT -1) and not 24 - PAGE_SHIFT ;-) So I wanted to find out why this:
> 1:	mempages >>= (23 - (PAGE_SHIFT - 1));
> 2:	order = max(2, fls(mempages));
> 3:	order = min(12, order);
> 
> should be similar to this original code:
> 4:	mempages >>= (14 - PAGE_SHIFT);
> 5:	mempages *= sizeof(struct hlist_head);
> 6:	for (order = 0; ((1UL << order) << PAGE_SHIFT) < mempages; order++)
> 7:		;
> 
> Well, first I saw that lines 2 and 3 make order to be between 2 and 12. OK 
> this is new, and I like it ;-) Then I saw you tried to convert the ugly lines 
> 6 + 7 into a fls() call. Fine! (I like that, too) Line 6 + 7 can be converted 

is fls(x) sort-of log2(x) via some "find-highest-bit-set"?
I recall discussing something related with Jesse Barnes
last 5 november (search for "[DMESG] cpumask_t in action" in lkml).

[SNIP]

Greets, Antonio Vargas

1. Dado un programa, siempre tiene al menos un fallo.
2. Dadas varias lineas de codigo, siempre se pueden acortar a menos lineas.
3. Por induccion, todos los programas se pueden
   reducir a una linea que no funciona.

  reply	other threads:[~2003-11-25 17:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-25 13:35 Jes Sorensen
2003-11-25 13:42 ` William Lee Irwin III
2003-11-25 13:54   ` Jes Sorensen
2003-11-25 16:25     ` Thomas Schlichter
2003-11-25 17:52       ` Antonio Vargas [this message]
2003-11-25 17:54         ` William Lee Irwin III
2003-11-25 20:48 ` Jack Steiner
2003-11-25 21:07   ` Andrew Morton
2003-11-25 21:14     ` Jesse Barnes
2003-11-25 21:24       ` Andrew Morton
2003-11-26  2:14         ` David S. Miller
2003-11-26  5:27         ` Matt Mackall
2003-11-28 14:15         ` Jes Sorensen
2003-11-28 14:52           ` Jack Steiner
2003-11-28 16:22             ` Jes Sorensen
2003-11-28 19:35               ` Jack Steiner
2003-11-28 21:18                 ` Jörn Engel
2003-12-01  9:46                   ` Jes Sorensen
2003-12-01 21:06     ` Anton Blanchard
2003-12-01 22:57       ` Martin J. Bligh
2003-11-25 21:16   ` Anton Blanchard
2003-11-25 23:11     ` Jack Steiner
2003-11-26  3:39       ` Rik van Riel
2003-11-26  3:59         ` William Lee Irwin III
2003-11-26  4:25           ` Andrew Morton
2003-11-26  4:23             ` William Lee Irwin III
2003-11-26  5:14           ` Martin J. Bligh
2003-11-26  9:51             ` William Lee Irwin III
2003-11-26 16:17               ` Martin J. Bligh
2003-11-26  7:25       ` Anton Blanchard
2003-11-26  5:53 Zhang, Yanmin
2003-11-29 10:39 Manfred Spraul

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=20031125175215.GB30083@wind.cocodriloo.com \
    --to=wind@cocodriloo.com \
    --cc=akpm@osdl.org \
    --cc=jbarnes@sgi.com \
    --cc=jes@wildopensource.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schlicht@uni-mannheim.de \
    --cc=steiner@sgi.com \
    --cc=viro@math.psu.edu \
    --cc=wli@holomorphy.com \
    /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

all inboxes | Powered by JetHome®