All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manik Raina <manik@cisco.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] Re: [Trivial Patch] : (2.5 latest) More __builtin_expect() cleanup in
Date: Fri, 21 Jun 2002 06:23:59 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590701905697@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590701905695@msgid-missing>

[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]


	Latest diffs attached ...

Manik Raina wrote:
> 
> Manik Raina wrote:
> >
> > diff -u -r linux-2.5.22/include/asm-ia64/softirq.h real/include/asm-ia64/softirq.h
> > --- linux-2.5.22/include/asm-ia64/softirq.h     Mon Jun 17 08:01:35 2002
> > +++ real/include/asm-ia64/softirq.h     Fri Jun 21 10:44:05 2002
> > @@ -13,7 +13,7 @@
> >  #define local_bh_enable()                                                              \
> >  do {                                                                                   \
> >         __local_bh_enable();                                                            \
> > -       if (__builtin_expect(local_softirq_pending(), 0) && really_local_bh_count() == 0)       \
> > +       if (unlikely(local_softirq_pending()) && really_local_bh_count() == 0)  \
> >                 do_softirq();                                                           \
> >  } while (0)
> >
> 
>         I don't think softirq.h includes linux/compiler.h . Can you please include
>         that ?

[-- Attachment #2: new --]
[-- Type: text/plain, Size: 4045 bytes --]

diff -u -r linux-2.5.22/include/asm-ia64/delay.h linux-likely-patch/include/asm-ia64/delay.h
--- linux-2.5.22/include/asm-ia64/delay.h	Mon Jun 17 08:01:23 2002
+++ linux-likely-patch/include/asm-ia64/delay.h	Fri Jun 21 11:18:00 2002
@@ -15,6 +15,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/compiler.h>
 
 #include <asm/processor.h>
 
@@ -52,7 +53,7 @@
 
 	__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
 #ifdef CONFIG_ITANIUM
-	while (__builtin_expect ((__s32) result == -1, 0))
+	while (unlikely((__s32) result == -1)
 		__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
 #endif
 	return result;
diff -u -r linux-2.5.22/include/asm-ia64/pgalloc.h linux-likely-patch/include/asm-ia64/pgalloc.h
--- linux-2.5.22/include/asm-ia64/pgalloc.h	Mon Jun 17 08:01:23 2002
+++ linux-likely-patch/include/asm-ia64/pgalloc.h	Fri Jun 21 11:18:00 2002
@@ -17,6 +17,7 @@
 
 #include <linux/mm.h>
 #include <linux/threads.h>
+#include <linux/compiler.h>
 
 #include <asm/mmu_context.h>
 #include <asm/processor.h>
@@ -37,7 +38,7 @@
 {
 	unsigned long *ret = pgd_quicklist;
 
-	if (__builtin_expect(ret != NULL, 1)) {
+	if (likely(ret != NULL)) {
 		pgd_quicklist = (unsigned long *)(*ret);
 		ret[0] = 0;
 		--pgtable_cache_size;
@@ -52,9 +53,9 @@
 	/* the VM system never calls pgd_alloc_one_fast(), so we do it here. */
 	pgd_t *pgd = pgd_alloc_one_fast(mm);
 
-	if (__builtin_expect(pgd == NULL, 0)) {
+	if (unlikely(pgd == NULL)) {
 		pgd = (pgd_t *)__get_free_page(GFP_KERNEL);
-		if (__builtin_expect(pgd != NULL, 1))
+		if (likely(pgd != NULL))
 			clear_page(pgd);
 	}
 	return pgd;
@@ -80,7 +81,7 @@
 {
 	unsigned long *ret = (unsigned long *)pmd_quicklist;
 
-	if (__builtin_expect(ret != NULL, 1)) {
+	if (likely(ret != NULL)) {
 		pmd_quicklist = (unsigned long *)(*ret);
 		ret[0] = 0;
 		--pgtable_cache_size;
@@ -93,7 +94,7 @@
 {
 	pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL);
 
-	if (__builtin_expect(pmd != NULL, 1))
+	if (likely(pmd != NULL))
 		clear_page(pmd);
 	return pmd;
 }
@@ -125,7 +126,7 @@
 {
 	struct page *pte = alloc_pages(GFP_KERNEL, 0);
 
-	if (__builtin_expect(pte != NULL, 1))
+	if (likely(pte != NULL))
 		clear_page(page_address(pte));
 	return pte;
 }
@@ -135,7 +136,7 @@
 {
 	pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL);
 
-	if (__builtin_expect(pte != NULL, 1))
+	if (likely(pte != NULL))
 		clear_page(pte);
 	return pte;
 }
diff -u -r linux-2.5.22/include/asm-ia64/processor.h linux-likely-patch/include/asm-ia64/processor.h
--- linux-2.5.22/include/asm-ia64/processor.h	Mon Jun 17 08:01:30 2002
+++ linux-likely-patch/include/asm-ia64/processor.h	Fri Jun 21 11:18:00 2002
@@ -16,6 +16,7 @@
 #include <linux/config.h>
 
 #include <linux/percpu.h>
+#include <linux/compiler.h>
 
 #include <asm/ptrace.h>
 #include <asm/kregs.h>
@@ -283,7 +284,7 @@
 	regs->loadrs = 0;									\
 	regs->r8 = current->mm->dumpable;	/* set "don't zap registers" flag */		\
 	regs->r12 = new_sp - 16;	/* allocate 16 byte scratch area */			\
-	if (!__builtin_expect (current->mm->dumpable, 1)) {					\
+	if (unlikely(!current->mm->dumpable)) {					\
 		/*										\
 		 * Zap scratch regs to avoid leaking bits between processes with different	\
 		 * uid/privileges.								\
diff -u -r linux-2.5.22/include/asm-ia64/softirq.h linux-likely-patch/include/asm-ia64/softirq.h
--- linux-2.5.22/include/asm-ia64/softirq.h	Mon Jun 17 08:01:35 2002
+++ linux-likely-patch/include/asm-ia64/softirq.h	Fri Jun 21 11:34:04 2002
@@ -6,6 +6,7 @@
  *	David Mosberger-Tang <davidm@hpl.hp.com>
  */
 #include <asm/hardirq.h>
+#include <linux/compiler.h>
 
 #define __local_bh_enable()	do { barrier(); really_local_bh_count()--; } while (0)
 
@@ -13,7 +14,7 @@
 #define local_bh_enable()								\
 do {											\
 	__local_bh_enable();								\
-	if (__builtin_expect(local_softirq_pending(), 0) && really_local_bh_count() == 0)	\
+	if (unlikely(local_softirq_pending()) && really_local_bh_count() == 0)	\
 		do_softirq();								\
 } while (0)
 

  parent reply	other threads:[~2002-06-21  6:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-21  5:51 [Linux-ia64] Re: [Trivial Patch] : (2.5 latest) More __builtin_expect() cleanup in Manik Raina
2002-06-21  6:10 ` Manik Raina
2002-06-21  6:23 ` Manik Raina [this message]
2002-06-21  7:55 ` [Linux-ia64] Re: [Trivial Patch] : (2.5 latest) More Andreas Schwab
2002-06-21  8:04 ` [Linux-ia64] Re: [Trivial Patch] : (2.5 latest) Manik Raina

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=marc-linux-ia64-105590701905697@msgid-missing \
    --to=manik@cisco.com \
    --cc=linux-ia64@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.