public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	Andi Kleen <ak@suse.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] optimise copy page range
Date: Fri, 18 Feb 2005 00:53:48 +1100	[thread overview]
Message-ID: <4214A1EC.4070102@yahoo.com.au> (raw)

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

Some of you have seen this before. Just resending because
I based my next patch on top of this one.

[-- Attachment #2: mm-opt-cpr.patch --]
[-- Type: text/plain, Size: 1397 bytes --]



Suggested by Linus: optimise a condition in the clear_p?d_range functions.
Results in one less conditional branch on i386 with gcc-3.4.4

Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>


---

 linux-2.6-npiggin/mm/memory.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff -puN mm/memory.c~mm-opt-cpr mm/memory.c
--- linux-2.6/mm/memory.c~mm-opt-cpr	2005-02-16 13:45:11.000000000 +1100
+++ linux-2.6-npiggin/mm/memory.c	2005-02-16 13:45:11.000000000 +1100
@@ -98,7 +98,8 @@ static inline void clear_pmd_range(struc
 		pmd_clear(pmd);
 		return;
 	}
-	if (!(start & ~PMD_MASK) && !(end & ~PMD_MASK)) {
+	if (!((start | end) & ~PMD_MASK)) {
+		/* Only clear full, aligned ranges */
 		page = pmd_page(*pmd);
 		pmd_clear(pmd);
 		dec_page_state(nr_page_table_pages);
@@ -131,7 +132,8 @@ static inline void clear_pud_range(struc
 		addr = next;
 	} while (addr && (addr < end));
 
-	if (!(start & ~PUD_MASK) && !(end & ~PUD_MASK)) {
+	if (!((start | end) & ~PUD_MASK)) {
+		/* Only clear full, aligned ranges */
 		pud_clear(pud);
 		pmd_free_tlb(tlb, __pmd);
 	}
@@ -162,7 +164,8 @@ static inline void clear_pgd_range(struc
 		addr = next;
 	} while (addr && (addr < end));
 
-	if (!(start & ~PGDIR_MASK) && !(end & ~PGDIR_MASK)) {
+	if (!((start | end) & ~PGDIR_MASK)) {
+		/* Only clear full, aligned ranges */
 		pgd_clear(pgd);
 		pud_free_tlb(tlb, __pud);
 	}

_

             reply	other threads:[~2005-02-17 13:54 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-17 13:53 Nick Piggin [this message]
2005-02-17 14:03 ` [PATCH 2/2] page table iterators Nick Piggin
2005-02-17 15:56   ` Linus Torvalds
2005-02-17 16:13     ` Nick Piggin
2005-02-17 19:43   ` Andi Kleen
2005-02-17 22:49     ` Benjamin Herrenschmidt
2005-02-17 23:03       ` Andi Kleen
2005-02-17 23:21         ` Benjamin Herrenschmidt
2005-02-17 23:34           ` Andi Kleen
2005-02-17 23:30         ` David S. Miller
2005-02-17 23:57           ` Andi Kleen
2005-02-20 12:35             ` Nick Piggin
2005-02-21  6:35               ` Hugh Dickins
2005-02-21  6:40                 ` Andrew Morton
2005-02-21  7:09                   ` Benjamin Herrenschmidt
2005-02-21  8:09                     ` Nick Piggin
2005-02-21  9:04                       ` Nick Piggin
2005-02-22  9:54                 ` Nick Piggin
2005-02-23  2:06                   ` Hugh Dickins
2005-02-23  4:31                     ` David S. Miller
2005-02-23  4:49                       ` Nick Piggin
2005-02-23  4:57                         ` David S. Miller
2005-02-23  5:23                       ` Nick Piggin
2005-02-23 23:52                     ` Nick Piggin
2005-02-24  0:00                       ` David S. Miller
2005-02-24  5:12                       ` Hugh Dickins
2005-02-24  5:59                         ` Nick Piggin
2005-02-24 11:58                           ` Hugh Dickins
2005-02-24 19:33                             ` David S. Miller
2005-02-25 10:44                               ` Andi Kleen
2005-02-24 21:59                             ` Nick Piggin
2005-02-24 22:32                               ` Hugh Dickins
2005-02-24 22:52                                 ` Nick Piggin

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=4214A1EC.4070102@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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