El Sun, 18 Apr 2010 23:28:52 +0600 Волков Максим <vstrange...@gmail.com> escribió:
> I noticed that the paging starts only when the number in the free > queue of pages is less than vm_page_free_min and continues until it > reaches free_target. Variable vm_page_free_target is set via macro > VM_PAGE_FREE_TARGET. > > #ifndef VM_PAGE_FREE_MIN > #define VM_PAGE_FREE_MIN(free) (10 + (free) / 100) > #endif /* VM_PAGE_FREE_MIN */ > > # Ifndef VM_PAGE_FREE_TARGET > # define VM_PAGE_FREE_TARGET (free) (15 + (free) / 80) > # endif / * > > If we assume that the free 2 GB of memory, then vm_page_free_targe > about 25 mb. In the linux kernel swapping start to work actively, when > free memory is 20-25% of total RAM. > > I think that macros VM_PAGE_FREE_TARGET VM_PAGE_FREE_MIN should be > changed. This patch modifies these macros: > Hi, Increasing VM_PAGE_FREE_TARGET could be dangerous, as it will raise the "want_pages" flag prematurely, and GNU Mach will start paging out anonymous memory. I think you're in the right direction, but we need a broader approach. Separating external pages (from externally managed memory objects) from anonymous pages in a different pair of active/inactive queues could be a nice start. Inactive pages from external memory objects can be safely considered as cache, so we could play some tricks with them (starting to page them early, freeing clean pages first, detecting access patterns...).