Hi,
I have some problems about do_brk function in linux,I think many of friends here know more about linux souce code than I do,
We all know that when the process wants to allocate heap space for users,we use the function do_brk,then do_brk will use make_pages_present,then my questions are:
1.in do_brk,if we want to use make_pages_present function,we should set the vm_lockflag,then vm_lock flag is always set in do_brk,if be set,when it is set?
2.when make_pages_present function have been used by do_brk,we know that a parameter called "write "will be passed to handle_mm_fault function by make_pages_present,in this situation,the value of the parameter "write" must be 1,so when the handle_mm_fault needs to use handle_pte_fault,the handle_pte_fault will use alloc_pages function to allocate page frame(physical memory) for the process heap space,that is to say we will build the mapping from the virtual address to physical address,then I do not understand linux has lazy-allocation feature,why in this situation it immediately allocates memory for the process ,why it does not delay the allocation until the process really accesses the page.
About do_brk function in linux
-
- Posts: 10
- Joined: Sat Mar 01, 2008 11:27 pm
Re: About do_brk function in linux
Do some one know that? I can not understand why that
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: About do_brk function in linux
This place is mainly about homebrew OSes, not linux internals.
From what I gathered from your post alone, do_brk calls make_pages_present, which in turn tells the MM to to perform a specific action on a pagefault (allocate a page when it is being written to) Now go figure wether that is lazy allocation or not.
As for the first question, it's even less understandable what you are trying to do here.
From what I gathered from your post alone, do_brk calls make_pages_present, which in turn tells the MM to to perform a specific action on a pagefault (allocate a page when it is being written to) Now go figure wether that is lazy allocation or not.
As for the first question, it's even less understandable what you are trying to do here.