linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: William Lee Irwin III <wli@holomorphy.com>,
	Christoph Lameter <clameter@sgi.com>,
	linux-mm@kvack.org
Subject: Re: ZERO_PAGE refcounting causes cache line bouncing
Date: Mon, 19 Mar 2007 17:24:32 +1100	[thread overview]
Message-ID: <45FE2CA0.3080204@yahoo.com.au> (raw)
In-Reply-To: <45FE261F.3030903@yahoo.com.au>

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

Nick Piggin wrote:

> I've always thought the bouncing issue was a silly one and should be
> fixed, of course. Maybe the reason my fix was vetoed was lack of numbers.
> Christoph, would you oblige? I'll dig out the patch and repost.

Something like this roughly should get rid of ZERO_PAGE _count and _mapcount
manipulation for anonymous pages. (others still exist, XIP and /dev/zero, but
they should not be a large concern AFAIKS).

I haven't booted this, but it is a quick forward port + some fixes and
simplifications.

-- 
SUSE Labs, Novell Inc.

[-- Attachment #2: mm-special-case-ZERO_PAGE.patch --]
[-- Type: text/plain, Size: 1012 bytes --]

Index: linux-2.6/mm/memory.c
===================================================================
--- linux-2.6.orig/mm/memory.c
+++ linux-2.6/mm/memory.c
@@ -665,7 +665,8 @@ static unsigned long zap_pte_range(struc
 			ptent = ptep_get_and_clear_full(mm, addr, pte,
 							tlb->fullmm);
 			tlb_remove_tlb_entry(tlb, pte, addr);
-			if (unlikely(!page))
+			if (unlikely(!page ||
+				(!vma->vm_file && page == ZERO_PAGE(addr))))
 				continue;
 			if (unlikely(details) && details->nonlinear_vma
 			    && linear_page_index(details->nonlinear_vma,
@@ -2152,15 +2153,12 @@ static int do_anonymous_page(struct mm_s
 	} else {
 		/* Map the ZERO_PAGE - vm_page_prot is readonly */
 		page = ZERO_PAGE(address);
-		page_cache_get(page);
 		entry = mk_pte(page, vma->vm_page_prot);
 
 		ptl = pte_lockptr(mm, pmd);
 		spin_lock(ptl);
 		if (!pte_none(*page_table))
-			goto release;
-		inc_mm_counter(mm, file_rss);
-		page_add_file_rmap(page);
+			goto unlock;
 	}
 
 	set_pte_at(mm, address, page_table, entry);

  reply	other threads:[~2007-03-19  6:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-16 22:17 Christoph Lameter
2007-03-17  4:35 ` William Lee Irwin III
2007-03-19  5:56   ` Nick Piggin
2007-03-19  6:24     ` Nick Piggin [this message]
2007-03-19  6:41       ` Nick Piggin
2007-03-19 10:04         ` Nick Piggin
2007-03-19 17:06       ` Christoph Lameter
2007-03-20  2:53         ` Nick Piggin
2007-03-19 12:03     ` Robin Holt
2007-03-20  2:35       ` Nick Piggin
2007-03-19 12:46     ` William Lee Irwin III
2007-03-20  2:34       ` Nick Piggin
2007-03-19 17:04     ` Christoph Lameter

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=45FE2CA0.3080204@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    --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