On Sun, Jun 26, 2011 at 10:13 PM, Bharat Joshi <[email protected]> wrote: >>> I am currently uing NetBSD 2.0 (plan to move to new one in some >>> time). I need to add more physical memory after it has already been >>> initialized once using uvm_page_physload. >>> >>> When I tried to call uvm_page_physload again with this new RAM >>> area, it paniced. I then found out that a flag 'VM_PHYSSEG_NOADD' in >>> vmparam.h for mips needs to be disabled. I removed this flag and then >>> things seems to have worked as expected. >>> >>> I want expert's opinion on whether this method of adding new >>> physical memory in UVM is the right (may be the only) way in NetBSD >>> 2.0. Please do let me know. >> >> That would work to some extent. Limitations: >> >> - Data structures are not protected with locks. >> >> - Metadata (vm_page array) is allocated in somewhere by malloc(), not >> in the newly added physseg. >> >> So, if it works for you on NetBSD 2.0, I'd say it's OK for you. ;) >> > > Thanks for your response. It worked for me as all my applications are > working fine. I have not stressed this yet so we will know more about > it in coming days. > > Let me tell my exact requirement. I have some memory after kernel that > is being used for some purpose. I want to free it back to physical > memory once that purpose has completed. So I disabled that flag and > allow uvm_page_physload to be called again. > > I was not sure so asked this on the list. Now I have another question. > "Is there any other better way of doing this?" > > Can we do something like as follows: > > 1. Pass avail_start in uvm_page_physload with an offset (start - > avail_start ) of the memory which needs to be added in physical memory > later. This will make sure that we have pages created for the whole
I don't understand what "which needs to be added in physical memory later". Could you elaborate this? > memory but only the ones available after avail_start is added as free > pages. > 2. Later find the pages for this memory (start to avail_start) and > call vm_page_free for each pages. > > I was thinking that such an API be available in uvm-page layer but > could not find one so not sure if something like the above can/should > be done. > > So it would be great if someone can tell me ways in which this can be > achieved in a better way. > > Regards, > Bharat >
