All of lore.kernel.org
 help / color / mirror / Atom feed
* linux page table
@ 2002-06-17 15:58 anya aitali
  2002-06-17 23:19 ` William Lee Irwin III
  2002-06-17 23:25 ` William Lee Irwin III
  0 siblings, 2 replies; 10+ messages in thread
From: anya aitali @ 2002-06-17 15:58 UTC (permalink / raw)
  To: linux-mm

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

Hi 
Can you oriented me. I had a PFN (page frame number) for 
one page and I want assign it to a entry for a pte_page.
What are the LINUX kernel functions should I use.
Thanks. 

_________________________________________________________ 
Envoyez des messages musicaux sur le portable de vos amis 
 http://mobile.lycos.fr/mobile/local/sms_musicaux/


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux page table
  2002-06-17 15:58 linux page table anya aitali
@ 2002-06-17 23:19 ` William Lee Irwin III
  2002-06-17 23:25 ` William Lee Irwin III
  1 sibling, 0 replies; 10+ messages in thread
From: William Lee Irwin III @ 2002-06-17 23:19 UTC (permalink / raw)
  To: anya aitali; +Cc: linux-mm

On Mon, Jun 17, 2002 at 04:58:27PM +0000, anya aitali wrote:
> Can you oriented me. I had a PFN (page frame number) for 
> one page and I want assign it to a entry for a pte_page.
> What are the LINUX kernel functions should I use.
> Thanks. 

What kernel version is this for?


Cheers,
Bill
--
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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux page table
  2002-06-17 15:58 linux page table anya aitali
  2002-06-17 23:19 ` William Lee Irwin III
@ 2002-06-17 23:25 ` William Lee Irwin III
  1 sibling, 0 replies; 10+ messages in thread
From: William Lee Irwin III @ 2002-06-17 23:25 UTC (permalink / raw)
  To: anya aitali; +Cc: linux-mm

On Mon, Jun 17, 2002 at 04:58:27PM +0000, anya aitali wrote:
> Can you oriented me. I had a PFN (page frame number) for 
> one page and I want assign it to a entry for a pte_page.
> What are the LINUX kernel functions should I use.
> Thanks. 

In 2.5 this is done with pfn_pte(), in 2.4 mk_pte().


Cheers,
Bill
--
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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* linux page table
@ 2012-09-01 19:30 Xin Tong
  2012-09-01 20:01 ` Shentino
  2012-09-02  8:10 ` Jiri Kosina
  0 siblings, 2 replies; 10+ messages in thread
From: Xin Tong @ 2012-09-01 19:30 UTC (permalink / raw)
  To: linux-kernel

When a process is created in Linux, corresponding page table is
implemented. In the current x86 linux, the page table is a multi-level
page table and CR3 points to the first level of the page table.  I
have 2 questions.

1. is the value in CR3 virtual address or physical address ?
2. can the address of the first level of the page table during a
process's lifetime change ?
3. can two different processes have their CR3 being the same value
even though they have different first level page tables ?

Thanks

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux page table
  2012-09-01 19:30 Xin Tong
@ 2012-09-01 20:01 ` Shentino
  2012-09-01 20:12   ` Xin Tong
  2012-09-02  8:10 ` Jiri Kosina
  1 sibling, 1 reply; 10+ messages in thread
From: Shentino @ 2012-09-01 20:01 UTC (permalink / raw)
  To: Xin Tong; +Cc: linux-kernel

On Sat, Sep 1, 2012 at 12:30 PM, Xin Tong <xerox.time.tech@gmail.com> wrote:
> When a process is created in Linux, corresponding page table is
> implemented. In the current x86 linux, the page table is a multi-level
> page table and CR3 points to the first level of the page table.  I
> have 2 questions.
>
> 1. is the value in CR3 virtual address or physical address ?

It's a physical address.  It points the CPU to it in physical memory.

More generally, all addresses in page tables, directories, etc are
physical addresses.

> 2. can the address of the first level of the page table during a
> process's lifetime change ?

This I don't know.

> 3. can two different processes have their CR3 being the same value
> even though they have different first level page tables ?

I'm not sure about this, but I think CR3 is actually bound to the
mm_struct and not the process.

Think about separate processes with the same address space, such as
multithreaded processes.

>
> Thanks
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux page table
  2012-09-01 20:01 ` Shentino
@ 2012-09-01 20:12   ` Xin Tong
  0 siblings, 0 replies; 10+ messages in thread
From: Xin Tong @ 2012-09-01 20:12 UTC (permalink / raw)
  To: Shentino; +Cc: linux-kernel

On Sat, Sep 1, 2012 at 1:01 PM, Shentino <shentino@gmail.com> wrote:
> On Sat, Sep 1, 2012 at 12:30 PM, Xin Tong <xerox.time.tech@gmail.com> wrote:
>> When a process is created in Linux, corresponding page table is
>> implemented. In the current x86 linux, the page table is a multi-level
>> page table and CR3 points to the first level of the page table.  I
>> have 2 questions.
>>
>> 1. is the value in CR3 virtual address or physical address ?
>
> It's a physical address.  It points the CPU to it in physical memory.
>
> More generally, all addresses in page tables, directories, etc are
> physical addresses.
>
>> 2. can the address of the first level of the page table during a
>> process's lifetime change ?
>
> This I don't know.
>
>> 3. can two different processes have their CR3 being the same value
>> even though they have different first level page tables ?
>
> I'm not sure about this, but I think CR3 is actually bound to the
> mm_struct and not the process.
>
> Think about separate processes with the same address space, such as
> multithreaded processes.

Do not all the threads share the same address space in a multithreaded program ?

Xin

>
>>
>> Thanks
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux page table
  2012-09-01 19:30 Xin Tong
  2012-09-01 20:01 ` Shentino
@ 2012-09-02  8:10 ` Jiri Kosina
  2012-09-02 15:56   ` Xin Tong
  1 sibling, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2012-09-02  8:10 UTC (permalink / raw)
  To: Xin Tong; +Cc: linux-kernel

On Sat, 1 Sep 2012, Xin Tong wrote:

> When a process is created in Linux, corresponding page table is
> implemented. In the current x86 linux, the page table is a multi-level
> page table and CR3 points to the first level of the page table.  I
> have 2 questions.
> 
> 1. is the value in CR3 virtual address or physical address ?

Physical, otherwise you will have chicken-egg problem.

> 2. can the address of the first level of the page table during a
> process's lifetime change ?

In theory it would be possible to implement. But I don't see a scenario 
when it might be useful.

> 3. can two different processes have their CR3 being the same value
> even though they have different first level page tables ?

Yes, if they are created by clone(CLONE_VM). In such case they share the 
same mm_struct, and therefore mm_struct->pgd (which is exactly what is 
loaded into cr3 in switch_mm()) is the same.

LKML is however very inappropriate list for such questions. Please ask on 
kernelnewbies list next time.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux page table
  2012-09-02  8:10 ` Jiri Kosina
@ 2012-09-02 15:56   ` Xin Tong
  2012-09-02 18:26     ` Jiri Kosina
  0 siblings, 1 reply; 10+ messages in thread
From: Xin Tong @ 2012-09-02 15:56 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel

On Sun, Sep 2, 2012 at 1:10 AM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Sat, 1 Sep 2012, Xin Tong wrote:
>
>> When a process is created in Linux, corresponding page table is
>> implemented. In the current x86 linux, the page table is a multi-level
>> page table and CR3 points to the first level of the page table.  I
>> have 2 questions.
>>
>> 1. is the value in CR3 virtual address or physical address ?
>
> Physical, otherwise you will have chicken-egg problem.
>
>> 2. can the address of the first level of the page table during a
>> process's lifetime change ?
>
> In theory it would be possible to implement. But I don't see a scenario
> when it might be useful.
>
>> 3. can two different processes have their CR3 being the same value
>> even though they have different first level page tables ?
>
> Yes, if they are created by clone(CLONE_VM). In such case they share the
> same mm_struct, and therefore mm_struct->pgd (which is exactly what is
> loaded into cr3 in switch_mm()) is the same.
>

Is this the COW mechanism in linux. what if the cloned process need to
have set of its own pages later. do the CR3s for the 2 processes
become different at that point ?

> LKML is however very inappropriate list for such questions. Please ask on
> kernelnewbies list next time.
>

Thank you for letting me know. Will do next time.
> --
> Jiri Kosina
> SUSE Labs
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux page table
  2012-09-02 15:56   ` Xin Tong
@ 2012-09-02 18:26     ` Jiri Kosina
  2012-09-04  8:48       ` Cong Wang
  0 siblings, 1 reply; 10+ messages in thread
From: Jiri Kosina @ 2012-09-02 18:26 UTC (permalink / raw)
  To: Xin Tong; +Cc: linux-kernel

On Sun, 2 Sep 2012, Xin Tong wrote:

> >> 3. can two different processes have their CR3 being the same value
> >> even though they have different first level page tables ?
> >
> > Yes, if they are created by clone(CLONE_VM). In such case they share the
> > same mm_struct, and therefore mm_struct->pgd (which is exactly what is
> > loaded into cr3 in switch_mm()) is the same.
> >
> 
> Is this the COW mechanism in linux. what if the cloned process need to
> have set of its own pages later. do the CR3s for the 2 processes
> become different at that point ?

That is a different story. COW is applied on fork() (i.e. spawning new 
process), not on clone(CLONE_VM) (i.e. spawning new thread).

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux page table
  2012-09-02 18:26     ` Jiri Kosina
@ 2012-09-04  8:48       ` Cong Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Cong Wang @ 2012-09-04  8:48 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Xin Tong, linux-kernel

On 09/03/2012 02:26 AM, Jiri Kosina wrote:
> On Sun, 2 Sep 2012, Xin Tong wrote:
>
>>>> 3. can two different processes have their CR3 being the same value
>>>> even though they have different first level page tables ?
>>>
>>> Yes, if they are created by clone(CLONE_VM). In such case they share the
>>> same mm_struct, and therefore mm_struct->pgd (which is exactly what is
>>> loaded into cr3 in switch_mm()) is the same.
>>>
>>
>> Is this the COW mechanism in linux. what if the cloned process need to
>> have set of its own pages later. do the CR3s for the 2 processes
>> become different at that point ?
>
> That is a different story. COW is applied on fork() (i.e. spawning new
> process), not on clone(CLONE_VM) (i.e. spawning new thread).
>

Yeah, and unshare(2) does not implement the flag that reverses the 
effects of CLONE_VM.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-09-04  8:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-17 15:58 linux page table anya aitali
2002-06-17 23:19 ` William Lee Irwin III
2002-06-17 23:25 ` William Lee Irwin III
  -- strict thread matches above, loose matches on Subject: below --
2012-09-01 19:30 Xin Tong
2012-09-01 20:01 ` Shentino
2012-09-01 20:12   ` Xin Tong
2012-09-02  8:10 ` Jiri Kosina
2012-09-02 15:56   ` Xin Tong
2012-09-02 18:26     ` Jiri Kosina
2012-09-04  8:48       ` Cong Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.