From mboxrd@z Thu Jan 1 00:00:00 1970 From: akpm@linux-foundation.org Subject: + vmscan-set-up-pagevec-as-late-as-possible-in-shrink_page_list.patch added to -mm tree Date: Fri, 02 Jul 2010 13:07:03 -0700 Message-ID: <201007022007.o62K73aC024273@imap1.linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:56640 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757575Ab0GBUHj (ORCPT ); Fri, 2 Jul 2010 16:07:39 -0400 Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: mm-commits@vger.kernel.org Cc: mel@csn.ul.ie, aarcange@redhat.com, chris.mason@oracle.com, david@fromorbit.com, hannes@cmpxchg.org, hch@infradead.org, kamezawa.hiroyu@jp.fujitsu.com, kosaki.motohiro@jp.fujitsu.com, mrubin@google.com, npiggin@suse.de, riel@redhat.com The patch titled vmscan: set up pagevec as late as possible in shrink_page_list() has been added to the -mm tree. Its filename is vmscan-set-up-pagevec-as-late-as-possible-in-shrink_page_list.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: vmscan: set up pagevec as late as possible in shrink_page_list() From: Mel Gorman shrink_page_list() sets up a pagevec to release pages as according as they are free. It uses significant amounts of stack on the pagevec. This patch adds pages to be freed via pagevec to a linked list which is then freed en-masse at the end. This avoids using stack in the main path that potentially calls writepage(). Signed-off-by: Mel Gorman Reviewed-by: Rik van Riel Cc: Dave Chinner Cc: Chris Mason Cc: Nick Piggin Cc: Rik van Riel Cc: Johannes Weiner Cc: Christoph Hellwig Cc: KAMEZAWA Hiroyuki Cc: KOSAKI Motohiro Cc: Andrea Arcangeli Cc: Michael Rubin Signed-off-by: Andrew Morton --- mm/vmscan.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff -puN mm/vmscan.c~vmscan-set-up-pagevec-as-late-as-possible-in-shrink_page_list mm/vmscan.c --- a/mm/vmscan.c~vmscan-set-up-pagevec-as-late-as-possible-in-shrink_page_list +++ a/mm/vmscan.c @@ -620,6 +620,24 @@ static enum page_references page_check_r return PAGEREF_RECLAIM; } +static noinline_for_stack void free_page_list(struct list_head *free_pages) +{ + struct pagevec freed_pvec; + struct page *page, *tmp; + + pagevec_init(&freed_pvec, 1); + + list_for_each_entry_safe(page, tmp, free_pages, lru) { + list_del(&page->lru); + if (!pagevec_add(&freed_pvec, page)) { + __pagevec_free(&freed_pvec); + pagevec_reinit(&freed_pvec); + } + } + + pagevec_free(&freed_pvec); +} + /* * shrink_page_list() returns the number of reclaimed pages */ @@ -628,13 +646,12 @@ static unsigned long shrink_page_list(st enum pageout_io sync_writeback) { LIST_HEAD(ret_pages); - struct pagevec freed_pvec; + LIST_HEAD(free_pages); int pgactivate = 0; unsigned long nr_reclaimed = 0; cond_resched(); - pagevec_init(&freed_pvec, 1); while (!list_empty(page_list)) { enum page_references references; struct address_space *mapping; @@ -809,10 +826,12 @@ static unsigned long shrink_page_list(st __clear_page_locked(page); free_it: nr_reclaimed++; - if (!pagevec_add(&freed_pvec, page)) { - __pagevec_free(&freed_pvec); - pagevec_reinit(&freed_pvec); - } + + /* + * Is there need to periodically free_page_list? It would + * appear not as the counts should be low + */ + list_add(&page->lru, &free_pages); continue; cull_mlocked: @@ -835,9 +854,10 @@ keep: list_add(&page->lru, &ret_pages); VM_BUG_ON(PageLRU(page) || PageUnevictable(page)); } + + free_page_list(&free_pages); + list_splice(&ret_pages, page_list); - if (pagevec_count(&freed_pvec)) - __pagevec_free(&freed_pvec); count_vm_events(PGACTIVATE, pgactivate); return nr_reclaimed; } _ Patches currently in -mm which might be from mel@csn.ul.ie are mm-vmscan-fix-mapping-use-after-free.patch linux-next.patch hugetlb-call-mmu-notifiers-on-hugepage-cow.patch mm-rename-anon_vma_lock-to-vma_lock_anon_vma.patch mm-change-direct-call-of-spin_lockanon_vma-lock-to-inline-function.patch mm-track-the-root-oldest-anon_vma.patch mm-always-lock-the-root-oldest-anon_vma.patch mm-extend-ksm-refcounts-to-the-anon_vma-root.patch mm-extend-ksm-refcounts-to-the-anon_vma-root-fix.patch vmscan-tracing-add-trace-events-for-kswapd-wakeup-sleeping-and-direct-reclaim.patch vmscan-tracing-add-trace-events-for-lru-page-isolation.patch vmscan-tracing-add-trace-events-for-lru-page-isolation-checkpatch-fixes.patch vmscan-tracing-add-trace-event-when-a-page-is-written.patch vmscan-tracing-add-a-postprocessing-script-for-reclaim-related-ftrace-events.patch vmscan-kill-prev_priority-completely.patch vmscan-simplify-shrink_inactive_list.patch vmscan-simplify-shrink_inactive_list-checkpatch-fixes.patch vmscan-remove-unnecessary-temporary-vars-in-do_try_to_free_pages.patch vmscan-remove-unnecessary-temporary-vars-in-do_try_to_free_pages-checkpatch-fixes.patch vmscan-set-up-pagevec-as-late-as-possible-in-shrink_inactive_list.patch vmscan-set-up-pagevec-as-late-as-possible-in-shrink_page_list.patch vmscan-update-isolated-page-counters-outside-of-main-path-in-shrink_inactive_list.patch delay-accounting-re-implement-c-for-getdelaysc-to-report-information-on-a-target-command.patch delay-accounting-re-implement-c-for-getdelaysc-to-report-information-on-a-target-command-checkpatch-fixes.patch add-debugging-aid-for-memory-initialisation-problems.patch