linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Dave McCracken <dmccr@us.ibm.com>,
	Pete Zaitcev <zaitcev@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] tweaks for page_convert_anon
Date: Fri, 4 Apr 2003 17:41:42 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0304041735150.1980-100000@localhost.localdomain> (raw)

A couple of small additions on top of Dave's objfix-2.5.66-mm3-3:

To maintain an accurate nr_mapped, page_remove_rmap must check
page_mapped with pte_chain_lock held, both at end and at start:
particularly now it's being called speculatively (in ignorance
of whether this pte is already listed or not).

Coincidentally, Pete Zaitcev's "gcc 3.2 breaks rmap on s390x" problem
reported yesterday would also be corrected by this, though it doesn't
fix the root of the problem (no barrier in pte_chain_lock on s390x).

Also, page_convert_anon remember pte_unmap after successful find_pte.

Hugh

--- 2.5.66-mm3-3/mm/rmap.c	Fri Apr  4 12:20:40 2003
+++ linux/mm/rmap.c	Fri Apr  4 16:13:42 2003
@@ -398,10 +398,10 @@
 		BUG();
 	if (!pfn_valid(page_to_pfn(page)) || PageReserved(page))
 		return;
-	if (!page_mapped(page))
-		return;		/* remap_page_range() from a driver? */
 
 	pte_chain_lock(page);
+	if (!page_mapped(page))
+		goto outer;
 
 	/*
 	 * If this is an object-based page, just uncount it.  We can
@@ -461,10 +461,10 @@
 		}
 	}
 out:
-	pte_chain_unlock(page);
 	if (!page_mapped(page))
 		dec_page_state(nr_mapped);
-	return;
+outer:
+	pte_chain_unlock(page);
 }
 
 /**
@@ -831,6 +831,7 @@
 			/* Make sure this isn't a duplicate */
 			page_remove_rmap(page, pte);
 			pte_chain = page_add_rmap(page, pte, pte_chain);
+			pte_unmap(pte);
 		}
 		spin_unlock(&vma->vm_mm->page_table_lock);
 	}
@@ -850,6 +851,7 @@
 			/* Make sure this isn't a duplicate */
 			page_remove_rmap(page, pte);
 			pte_chain = page_add_rmap(page, pte, pte_chain);
+			pte_unmap(pte);
 		}
 		spin_unlock(&vma->vm_mm->page_table_lock);
 	}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

             reply	other threads:[~2003-04-04 16:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-04 16:41 Hugh Dickins [this message]
2003-04-04 18:18 ` Andrew Morton

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=Pine.LNX.4.44.0304041735150.1980-100000@localhost.localdomain \
    --to=hugh@veritas.com \
    --cc=akpm@digeo.com \
    --cc=dmccr@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zaitcev@redhat.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