linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kanoj@google.engr.sgi.com (Kanoj Sarcar)
To: torvalds@transmeta.com
Cc: linux-mm@kvack.org
Subject: [PATCH] kanoj-mm22-2.3.23 mprotect/mremap minor fixes
Date: Thu, 28 Oct 1999 16:28:01 -0700 (PDT)	[thread overview]
Message-ID: <199910282328.QAA86411@google.engr.sgi.com> (raw)

Linus,

These are two small patches. The mprotect patch is needed to protect 
the pte updates from kswapd. The mremap patch is needed in the context
of clone's, where a clone of the process doing the mremap() might 
drag the old translation into the tlb right after mremamp() has done
the flush_tlb_range(), but before it has invalidated the old pte.

Thanks.

Kanoj

--- /usr/tmp/p_rdiff_a002W5/mprotect.c	Thu Oct 28 16:20:56 1999
+++ mm/mprotect.c	Thu Oct 28 14:08:55 1999
@@ -72,11 +72,13 @@
 	flush_cache_range(current->mm, beg, end);
 	if (start >= end)
 		BUG();
+	spin_lock(&current->mm->page_table_lock);
 	do {
 		change_pmd_range(dir, start, end - start, newprot);
 		start = (start + PGDIR_SIZE) & PGDIR_MASK;
 		dir++;
 	} while (start && (start < end));
+	spin_unlock(&current->mm->page_table_lock);
 	flush_tlb_range(current->mm, beg, end);
 	return;
 }
--- /usr/tmp/p_rdiff_a002WE/mremap.c	Thu Oct 28 16:21:12 1999
+++ mm/mremap.c	Thu Oct 28 14:14:40 1999
@@ -93,7 +93,6 @@
 	unsigned long offset = len;
 
 	flush_cache_range(mm, old_addr, old_addr + len);
-	flush_tlb_range(mm, old_addr, old_addr + len);
 
 	/*
 	 * This is not the clever way to do this, but we're taking the
@@ -105,6 +104,7 @@
 		if (move_one_page(mm, old_addr + offset, new_addr + offset))
 			goto oops_we_failed;
 	}
+	flush_tlb_range(mm, old_addr, old_addr + len);
 	return 0;
 
 	/*
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/

                 reply	other threads:[~1999-10-28 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=199910282328.QAA86411@google.engr.sgi.com \
    --to=kanoj@google.engr.sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@transmeta.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