linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* vmalloc fault
@ 2013-04-26  9:55 Simon Jeons
  2013-04-26 10:04 ` Rik van Riel
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Jeons @ 2013-04-26  9:55 UTC (permalink / raw)
  To: Linux Memory Management List
  Cc: Rik van Riel, Dave Hansen, Johannes Weiner, Michal Hocko,
	Mel Gorman

Hi all,

1. Why vmalloc fault need sync user process page table with kernel page 
table instead of using kernel page table directly?

2. Why do_swap_page doesn't set present flag?

3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user 
process alloc pages from zone_normal(which is direct mapping) when 
fallback, this page which allocated for user process will set present 
flag in related pte, correct? but why also set present flag for kernel 
direct mapping? Does kernel have any requirement to access it?

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: vmalloc fault
  2013-04-26  9:55 vmalloc fault Simon Jeons
@ 2013-04-26 10:04 ` Rik van Riel
  2013-04-26 10:17   ` Simon Jeons
  0 siblings, 1 reply; 5+ messages in thread
From: Rik van Riel @ 2013-04-26 10:04 UTC (permalink / raw)
  To: Simon Jeons
  Cc: Linux Memory Management List, Dave Hansen, Johannes Weiner,
	Michal Hocko, Mel Gorman

On 04/26/2013 05:55 AM, Simon Jeons wrote:
> Hi all,
>
> 1. Why vmalloc fault need sync user process page table with kernel page
> table instead of using kernel page table directly?

Each process has its own PGD, into which both kernel and user
PMDs (or PUDs) are mapped. It is possible the PGD is missing
some pointers, that need to be filled in at fault time.

> 2. Why do_swap_page doesn't set present flag?

It does.  Look at how vm_get_page_prot works.

> 3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user
> process alloc pages from zone_normal(which is direct mapping) when
> fallback, this page which allocated for user process will set present
> flag in related pte, correct? but why also set present flag for kernel
> direct mapping? Does kernel have any requirement to access it?


-- 
All rights reversed

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: vmalloc fault
  2013-04-26 10:04 ` Rik van Riel
@ 2013-04-26 10:17   ` Simon Jeons
  2013-04-26 10:19     ` Rik van Riel
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Jeons @ 2013-04-26 10:17 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Linux Memory Management List, Dave Hansen, Johannes Weiner,
	Michal Hocko, Mel Gorman

Morning Rik, so early.
On 04/26/2013 06:04 PM, Rik van Riel wrote:
> On 04/26/2013 05:55 AM, Simon Jeons wrote:
>> Hi all,
>>
>> 1. Why vmalloc fault need sync user process page table with kernel page
>> table instead of using kernel page table directly?
>
> Each process has its own PGD, into which both kernel and user
> PMDs (or PUDs) are mapped. It is possible the PGD is missing
> some pointers, that need to be filled in at fault time.

It seems that you miss my question. I mean why sync page table between 
user process and init_mm.pgd, can user process use init_mm.pgd page 
table directly when access vmalloc memory? ;-)

>
>> 2. Why do_swap_page doesn't set present flag?
>
> It does.  Look at how vm_get_page_prot works.

Got it.

>
>> 3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user
>> process alloc pages from zone_normal(which is direct mapping) when
>> fallback, this page which allocated for user process will set present
>> flag in related pte, correct? but why also set present flag for kernel
>> direct mapping? Does kernel have any requirement to access it?
>
>

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: vmalloc fault
  2013-04-26 10:17   ` Simon Jeons
@ 2013-04-26 10:19     ` Rik van Riel
  2013-04-26 10:27       ` Simon Jeons
  0 siblings, 1 reply; 5+ messages in thread
From: Rik van Riel @ 2013-04-26 10:19 UTC (permalink / raw)
  To: Simon Jeons
  Cc: Linux Memory Management List, Dave Hansen, Johannes Weiner,
	Michal Hocko, Mel Gorman

On 04/26/2013 06:17 AM, Simon Jeons wrote:
> Morning Rik, so early.
> On 04/26/2013 06:04 PM, Rik van Riel wrote:
>> On 04/26/2013 05:55 AM, Simon Jeons wrote:
>>> Hi all,
>>>
>>> 1. Why vmalloc fault need sync user process page table with kernel page
>>> table instead of using kernel page table directly?
>>
>> Each process has its own PGD, into which both kernel and user
>> PMDs (or PUDs) are mapped. It is possible the PGD is missing
>> some pointers, that need to be filled in at fault time.
>
> It seems that you miss my question. I mean why sync page table between
> user process and init_mm.pgd, can user process use init_mm.pgd page
> table directly when access vmalloc memory? ;-)

init_mm.pgd is never used as an actual mmu context after bootup.

>>
>>> 2. Why do_swap_page doesn't set present flag?
>>
>> It does.  Look at how vm_get_page_prot works.
>
> Got it.
>
>>
>>> 3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user
>>> process alloc pages from zone_normal(which is direct mapping) when
>>> fallback, this page which allocated for user process will set present
>>> flag in related pte, correct? but why also set present flag for kernel
>>> direct mapping? Does kernel have any requirement to access it?
>>
>>
>


-- 
All rights reversed

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: vmalloc fault
  2013-04-26 10:19     ` Rik van Riel
@ 2013-04-26 10:27       ` Simon Jeons
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Jeons @ 2013-04-26 10:27 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Linux Memory Management List, Dave Hansen, Johannes Weiner,
	Michal Hocko, Mel Gorman

On 04/26/2013 06:19 PM, Rik van Riel wrote:
> On 04/26/2013 06:17 AM, Simon Jeons wrote:
>> Morning Rik, so early.
>> On 04/26/2013 06:04 PM, Rik van Riel wrote:
>>> On 04/26/2013 05:55 AM, Simon Jeons wrote:
>>>> Hi all,
>>>>
>>>> 1. Why vmalloc fault need sync user process page table with kernel 
>>>> page
>>>> table instead of using kernel page table directly?
>>>
>>> Each process has its own PGD, into which both kernel and user
>>> PMDs (or PUDs) are mapped. It is possible the PGD is missing
>>> some pointers, that need to be filled in at fault time.
>>
>> It seems that you miss my question. I mean why sync page table between
>> user process and init_mm.pgd, can user process use init_mm.pgd page
>> table directly when access vmalloc memory? ;-)
>
> init_mm.pgd is never used as an actual mmu context after bootup.
>
>>>
>>>> 2. Why do_swap_page doesn't set present flag?
>>>
>>> It does.  Look at how vm_get_page_prot works.
>>
>> Got it.
>>
>>>
>>>> 3. When enable DEBUG_PAGEALLOC(catch use-after-free bug), if user
>>>> process alloc pages from zone_normal(which is direct mapping) when
>>>> fallback, this page which allocated for user process will set present
>>>> flag in related pte, correct? but why also set present flag for kernel
>>>> direct mapping? Does kernel have any requirement to access it?
>>>
>>>

Could you also answer this question? Thanks in advance. ;-) Is there 
something confuse you in my question?

>>
>
>

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-04-26 10:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26  9:55 vmalloc fault Simon Jeons
2013-04-26 10:04 ` Rik van Riel
2013-04-26 10:17   ` Simon Jeons
2013-04-26 10:19     ` Rik van Riel
2013-04-26 10:27       ` Simon Jeons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).