Hi, I am think of discard stack pages if the old Page is under the stack pointer(Assume stack grow down) of the task, This page don't need pageout, we can free it directly, When the task need it again, we just use a zero page to Map, it is safe for stack .
But I don't know how to implement it, And is there some issue if do like this ? The following is pseudo code to explain my ideas. Any comments are appreciated ! Thanks --- diff --git a/mm/vmscan.c b/mm/vmscan.c index dcb4707..52e8314 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -962,6 +962,12 @@ static unsigned long shrink_page_list(struct list_head *page_list, ; /* try to reclaim the page below */ } + if (page_vm_flags(page) & (VM_GROWSUP | VM_GROWSDOWN) && + PageAnon(page) && !PageSwapCache(page)) { + if (page_task_is_sleep(page) && task_sp > page->index) { + zap_page_range(vma, page->index, PAGE_SIZE); + } + } /* * Anonymous process memory has backing store? * Try to allocate it some swap space here. N�����r��y����b�X��ǧv�^�){.n�+����{����zX����ܨ}���Ơz�&j:+v�������zZ+��+zf���h���~����i���z��w���?�����&�)ߢf��^jǫy�m��@A�a��� 0��h���i