mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Harvey Harrison <harvey.harrison@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH] bitops: simplify generic bit finding functions
Date: Mon, 28 Apr 2008 21:26:11 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.1.10.0804282038160.3261@apollo.tec.linutronix.de> (raw)
In-Reply-To: <alpine.LFD.1.10.0804280953570.3119@woody.linux-foundation.org>

On Mon, 28 Apr 2008, Linus Torvalds wrote:
> > > > How about making the optimization controlled by a config switch so
> > > > arch maintainers can decide whether they want to enable the constant
> > > > optimization or unconditionally call the lib function ?
> > > 
> > > No.
> > > 
> > > This is just making that damn header line look worse and worse.
> > > 
> > > Is there a _reason_ to optimize this stupid function this way?
> > 
> > On architectures which have a find bit instruction we can replace the
> > call to the library function by a single instruction when the size of
> > the bitmap is less/equal bits per long and when the bitnr is a
> > constant.
> 
> That's not what I asked.
> 
> I asked whether there is a *reason* to optimize this and cause all these 
> stupid problems.
> 
> Is there a real hot path anywhere that actually uses this and depends on 
> it?

Sorry, misunderstood your question. 

I checked the use cases and have not found a single one for
find_next_(zero_)bit() which makes use of this micro optimization. In
fact the .text section of vmlinux of the "optimized" and the straight
function call are identical. So the effect of those micro
optimizations is exactly zero.

find_first_(zero_)bit() has a couple of places where the optimization
hits, but the code size reduction is mere 21 bytes and the use cases
are not in real hot pathes AFAICT.

I doubt that that is worth the trouble and we should just remove those
inlines alltogether. This was discussed before, but Andi objected to
remove those micro optimizations and nobody had time to actually
verify the real benefits.

I'll whip up a patch.

Thanks,

	tglx

  reply	other threads:[~2008-04-28 19:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-27 20:19 Harvey Harrison
2008-04-27 20:26 ` Linus Torvalds
2008-04-27 20:29   ` Harvey Harrison
2008-04-27 20:36     ` Al Viro
2008-04-27 20:38       ` Harvey Harrison
2008-04-27 20:38     ` Linus Torvalds
2008-04-27 21:02       ` Al Viro
2008-04-28 14:04   ` Thomas Gleixner
2008-04-28 15:10     ` Alexander van Heukelum
2008-04-28 15:58       ` Thomas Gleixner
2008-04-28 16:25     ` Linus Torvalds
2008-04-28 16:47       ` Thomas Gleixner
2008-04-28 16:54         ` Linus Torvalds
2008-04-28 19:26           ` Thomas Gleixner [this message]
2008-04-28 19:37             ` Linus Torvalds
2008-04-28 21:55               ` Ingo Molnar
2008-04-29 10:01               ` [PATCH] bitops: remove "optimizations" Thomas Gleixner
2008-04-29 10:03                 ` David Miller
2008-04-29 12:34                   ` David Miller
2008-04-29 14:20                     ` Ingo Molnar
2008-04-29 22:31                       ` David Miller
2008-04-29 16:51                     ` Thomas Gleixner
2008-04-29 22:58                       ` David Miller
2008-04-29 23:30                         ` David Miller
2008-04-28 19:57           ` [PATCH] bitops: simplify generic bit finding functions Andi Kleen
2008-04-28 14:58   ` Alexander van Heukelum
2008-04-28 14:32 ` Alexander van Heukelum

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=alpine.LFD.1.10.0804282038160.3261@apollo.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=harvey.harrison@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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

Powered by JetHome