2001-11-28 12:03:22

by Frank Cornelis

[permalink] [raw]
Subject: task_struct.mm == NULL

Hey,

I found in some code checks for task_struct.mm being NULL.
When can task_struct.mm of a process be NULL except right before the
process-kill?

Frank.


2001-11-28 12:18:36

by Tigran Aivazian

[permalink] [raw]
Subject: Re: task_struct.mm == NULL

Hi Frank,

It can be NULL for kernel threads which do not have a user address
space. Nevertheless, their tsk->active_mm would not be NULL but point to
some process' address space.

The point of having active_mm is to minimize TLB flushes on switching
address spaces when the task is scheduled out.

Regards,
Tigran

On Wed, 28 Nov 2001, Frank Cornelis wrote:

> Hey,
>
> I found in some code checks for task_struct.mm being NULL.
> When can task_struct.mm of a process be NULL except right before the
> process-kill?
>
> Frank.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2001-11-28 12:23:46

by Andi Kleen

[permalink] [raw]
Subject: Re: task_struct.mm == NULL

Frank Cornelis <[email protected]> writes:

> Hey,
>
> I found in some code checks for task_struct.mm being NULL.
> When can task_struct.mm of a process be NULL except right before the
> process-kill?

For kernel threads that run in lazy-mm mode. It allows a much cheaper context
switch into kernel threads.

-Andi

2001-11-28 14:13:32

by Shaya Potter

[permalink] [raw]
Subject: Re: task_struct.mm == NULL

On Wed, 2001-11-28 at 07:23, Andi Kleen wrote:
> Frank Cornelis <[email protected]> writes:
>
> > Hey,
> >
> > I found in some code checks for task_struct.mm being NULL.
> > When can task_struct.mm of a process be NULL except right before the
> > process-kill?
>
> For kernel threads that run in lazy-mm mode. It allows a much cheaper context
> switch into kernel threads.

oh. so not all kernel threades have mm == null. I used to think that
kernel threads ran in the kernel's address space, therefore there was no
point in having an mm struct as that just defines a virtual process
address space. What's this lazy_mm mode?

thanks,

shaya