linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@redhat.com>
To: torvalds@transmeta.com
Cc: linux-mm@kvack.org, Jack Steiner <steiner@sgi.com>
Subject: [steiner@sgi.com: Re: TLB flushing in 2.4.14]
Date: Fri, 7 Dec 2001 01:45:04 -0500	[thread overview]
Message-ID: <20011207014503.A7964@redhat.com> (raw)

Hey folks,

I'm just going through my backlog, and this patch looks reasonable to 
me.  Linus, could you drop this into 2.5?

		-ben

----- Forwarded message from Jack Steiner <steiner@sgi.com> -----

From: Jack Steiner <steiner@sgi.com>
Subject: Re: TLB flushing in 2.4.14
To: bcrl@redhat.com (Benjamin LaHaise)
Date: Wed, 28 Nov 2001 14:01:14 -0600 (CST)
In-Reply-To: <20011127132519.B19568@redhat.com> from "Benjamin LaHaise" at Nov 27, 2001 01:25:19 PM
X-Mailer: ELM [version 2.5 PL2]

> 
> On Tue, Nov 27, 2001 at 12:22:28PM -0600, Jack Steiner wrote:
> > Do you see any problems with this patch??  
> > 
> > (I also sent a copy of this to Andrea Arcangeli)
> 
> Yes.  Your system will now happily corrupt memory if you run ps or top at 
> the right time.  I'd suggested adding an mm->dead flag and using that 
> instead, but Linus is the keeper of the vm code, so run it by him.

You are right, of course. I should have studied the code better.

Here is a much cleaner fix (ignore the previous patch completely). This
keeps all the changes in just one spot - no changes to fs/exec.c. 

Do you see any problems here...



--- linux_base/include/asm-generic/tlb.h	Wed Oct 31 08:06:36 2001
+++ linux/include/asm-generic/tlb.h	Wed Nov 28 13:56:03 2001
@@ -43,7 +43,7 @@
 
 	tlb->mm = mm;
 	/* Use fast mode if there is only one user of this mm (this process) */
-	tlb->nr = (atomic_read(&(mm)->mm_users) == 1) ? ~0UL : 0UL;
+	tlb->nr = (atomic_read(&(mm)->mm_users) <= 1) ? ~0UL : 0UL;
 	return tlb;
 }
 
@@ -70,6 +70,8 @@
 /* tlb_finish_mmu
  *	Called at the end of the shootdown operation to free up any resources
  *	that were required.  The page talbe lock is still held at this point.
+ *	Note that no TLB flushes are needed if there are no users of the mm
+ *	context.
  */
 static inline void tlb_finish_mmu(struct free_pte_ctx *ctx, unsigned long start, unsigned long end)
 {
@@ -77,7 +79,8 @@
 
 	/* Handle the fast case first. */
 	if (ctx->nr == ~0UL) {
-		flush_tlb_range(ctx->mm, start, end);
+		if (ctx->mm->mmap)
+			flush_tlb_range(ctx->mm, start, end);
 		return;
 	}
 	nr = ctx->nr;

-- 
Thanks

Jack Steiner    (651-683-5302)   (vnet 233-5302)      steiner@sgi.com

----- End forwarded message -----

-- 
Fish.
--
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/

                 reply	other threads:[~2001-12-07  6:45 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=20011207014503.A7964@redhat.com \
    --to=bcrl@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=steiner@sgi.com \
    --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