Contents of CR3 register when a kernel thread is executed

Peter Teoh htmldeveloper at
Tue Apr 19 08:49:14 EDT 2011

On Mon, Apr 18, 2011 at 9:17 PM, limp <johnkyr83 at> wrote:

> Hi all,
> I am trying to understand in what extend the PGD (page global directory)
> value stored in the CR3 register indicate the running process/thread by the
> Linux scheduler.

> I know that each process has its own PGD value but what I am confused about
> is the value of CR3 register when kernel threads are scheduled.
yes, each process has its own CR3 value -> u can easily see this when u do a
printk() of it....and it is always equal to the process (which is "insmod"
usually) that started the kernel module.   i experimented it here:

> AFAIK, a "kernel thread" can 'borrow' the page-directory that belongs to
> another process (i.e. its address space). Does this apply *only* to threads

yes, "borrow" in the sense that:   kernel thread DOES NOT have any process
context, and so it can be executed in any process context, and which ever
process context it is executing, when u print the CR3 value, it will belong
to that process which the kernel thread is currently executing under.

read this:

> of the same process (i.e. all the threads of process A are using the PGD
> entry of process A) or could also apply to threads not relevant to process
> A?
> That is, if a thread is executed and the value of CR3 at the time is
> 0x1E107000, does this *necessary* mean that a thread of the process with
> 0xDE107000 is executed *or* a thread not relevant with that process could
> have 'borrowed' its PGD entry?
> Any help will be greatly appreciated.
> John K.
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at

Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list