linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: Hai Huang <haih@eecs.umich.edu>
Cc: linux-mm@kvack.org
Subject: Re: active_mm and mm
Date: Tue, 20 Aug 2002 10:19:50 +0100	[thread overview]
Message-ID: <20020820101950.A2645@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0208192207430.18993-100000@wildwood.eecs.umich.edu>; from haih@eecs.umich.edu on Mon, Aug 19, 2002 at 10:09:50PM -0400

Hi,

On Mon, Aug 19, 2002 at 10:09:50PM -0400, Hai Huang wrote:
> In struct task_struct, what's the difference between active_mm and mm?  I
> vaguely remembers it's used for reducing cache overhead during context
> switch, is this right

Yep.  Many context switches don't require us to switch to the mm of
the newly running process.  All processes share exactly the same
kernel address space, so as long as we are only accessing kernel
memory and not per-process memory, we don't need to do the mm switch.

So, for operations such as waiting on an IO event, a process might get
woken up, check some kernel space data structures, and go back to
sleep, all in side a system call and never touching user space.  It's
a waste to switch to the process's mm just for that --- we'd end up
throwing out the tlb cache of the old process for nothing.

So, Linux has a "LAZY_TLB" mode which tasks such as the idle task
(which never touch user space) all have set, and which tasks can enter
if they are spinning in kernel space for a while.  When we switch to a
LAZY_TLB task, we don't get a new mm, so the new task's active_mm
is set to whatever the old task's active_mm was.  For non-LAZY_TLB
running tasks, active_mm and mm should be the same.

--Stephen
--
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:[~2002-08-20  9:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-20  2:09 Hai Huang
2002-08-20  9:19 ` Stephen C. Tweedie [this message]
2002-08-20 14:55   ` Hai Huang
2002-08-20 15:52     ` Stephen C. Tweedie

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=20020820101950.A2645@redhat.com \
    --to=sct@redhat.com \
    --cc=haih@eecs.umich.edu \
    --cc=linux-mm@kvack.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