PATCH: Cleaning up of the function shrink_mmap (WIP)
Subsystems (5)
Hi
in this patch (Work in progress) I am cleaning up the
function shrink_mmap. This is a work in progress, I am trying to solve the slowdown than happen when the page cache becomes very big and we need to wait (too much) before to be able to continue. You can see the effect easily with a program like mmap002 or a dd of a big file and one vmstat 1 in other window. The slowdown happen when the system is using all the memory (120MB in a 128MB system) for page_cache, in that moment, you can see in the window of the vmstat that it takes as much as 5/6 seconds to write the next line (I have vmstat 1 command). To the moment no success finding the cause of the slowdown.
The patch applies in top of pre9-3 + my patch wait_buffers_03.patch. (You can get the patches from
http://carpanta.dc.fi.udc.es/~quintela/kernel).
The patch does:
- define __lru_cache_add, to be able to manipulate the lru_cache list without having to worry about the nr_lru_pages counter.
- It documents a bit shrink_mmap and reformat all the comments in a consistent way, and update the comments when needed.
- It changes the meaning of my nr_dirty from my previous patch to mean wait each priority pages, not _all_ the pages except the first priority ones.
- It returns the counter in do_try_to_free pages to the value in vanilla pre9-3, this change made it to scan _all_ pages in the last 16 priorities.
- minor cleanup in the return case of that function.
Comment and suggestions about where can be the cause of the slowdown are welcome and appreciated.
Later, Juan.
PD. Linus, if you want a separate patch with only the bits relative a my
previous patch, or other modification, ask for it.
include/linux/swap.h +7 -2
@@ -163,11 +163,16 @@/* * Helper macros for lru_pages handling. */ -#define lru_cache_add (page) \ +#define __lru_cache_add (page) \ do { \ - spin_lock(&pagemap_lru_lock); \ list_add(&(page)->lru, &lru_cache); \ nr_lru_pages++; \ +} while (0) + +#define lru_cache_add (page) \ +do { \ + spin_lock(&pagemap_lru_lock); \ + __lru_cache_add(page); \ spin_unlock(&pagemap_lru_lock); \ } while (0)
mm/filemap.c +41 -33
127 lines not on this page · raw message
mm/vmscan.c +2 -4
@@ -363,7 +363,7 @@* Think of swap_cnt as a "shadow rss" - it tells us which process * we want to page out (always try largest first). */ - counter = (nr_threads <<2 ) >> (priority >>2 ); + counter = (nr_threads <<1 ) >> (priority >>1 );if (counter <1 ) counter =1 ;
@@ -485,10 +485,8 @@ goto done; }/* We return 1 if we are freed some page */ -return (count !=FREE_COUNT ); - done: -return 1 ; +return (count <FREE_COUNT ); }DECLARE_WAIT_QUEUE_HEAD (kswapd_wait);
Signature · 6 lines
In theory, practice and theory are the same, but in practice they are different -- Larry McVoy -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/