public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Keith Owens <kaos@ocs.com.au>
Cc: linux-kernel@vger.kernel.org, torvalds@transmeta.org
Subject: Re: [patch] 2.5.9 remove warnings
Date: Tue, 23 Apr 2002 11:32:15 -0700	[thread overview]
Message-ID: <3CC5A8AF.432380E3@zip.com.au> (raw)
In-Reply-To: <10704.1019533171@kao2.melbourne.sgi.com>

Keith Owens wrote:
> 
> ...
> @@ -47,7 +47,7 @@ static inline void __unhash_process(stru
>                 spin_unlock(&dcache_lock);
>         }
>         write_unlock_irq(&tasklist_lock);
> -       if (unlikely(proc_dentry)) {
> +       if (unlikely(proc_dentry != NULL)) {
>                 shrink_dcache_parent(proc_dentry);
>                 dput(proc_dentry);
>         }

Is it not possible to fix it for all time?

--- linux-2.5.9/include/linux/compiler.h	Sun Apr 14 15:45:08 2002
+++ 25/include/linux/compiler.h	Tue Apr 23 11:27:37 2002
@@ -10,8 +10,8 @@
 #define __builtin_expect(x, expected_value) (x)
 #endif
 
-#define likely(x)	__builtin_expect((x),1)
-#define unlikely(x)	__builtin_expect((x),0)
+#define likely(x)	__builtin_expect((x) != 0, 1)
+#define unlikely(x)	__builtin_expect((x) != 0, 0)
 
 /* This macro obfuscates arithmetic on a variable address so that gcc
    shouldn't recognize the original var, and make assumptions about it */

(Interestingly, this patch shrinks my kernel by 32 bytes.  hmm.)

BTW, it would be very useful if someone could invert the sense of
`likely' and `unlikely', so they always say the *wrong* thing, and
then actually demonstrate some real-world slowdown.  coz if this
can't be done, why are we putting up with the visual clutter?

-

  parent reply	other threads:[~2002-04-23 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-23  3:39 [patch] 2.5.9 remove warnings Keith Owens
2002-04-23  9:37 ` Daniel Phillips
2002-04-23 18:32 ` Andrew Morton [this message]
2002-04-23 21:08   ` Kasper Dupont
2002-04-24 18:56     ` Ingo Oeser

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=3CC5A8AF.432380E3@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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