rpms/kernel/F-11 linux-2.6-defaults-saner-vm-settings.patch, 1.2, 1.3 linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch, 1.3, 1.4 linux-2.6-mm-lru-evict-streaming-io-pages-first.patch, 1.3, 1.4 linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch, 1.2, 1.3 kernel.spec, 1.1697, 1.1698

Kyle McMartin kyle at fedoraproject.org
Mon Aug 10 20:18:35 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6750

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-defaults-saner-vm-settings.patch 
	linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch 
	linux-2.6-mm-lru-evict-streaming-io-pages-first.patch 
	linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch 
Log Message:
sync up vm tweaks

linux-2.6-defaults-saner-vm-settings.patch:
 vmscan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6-defaults-saner-vm-settings.patch
===================================================================
RCS file: linux-2.6-defaults-saner-vm-settings.patch
diff -N linux-2.6-defaults-saner-vm-settings.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-defaults-saner-vm-settings.patch	10 Aug 2009 20:18:34 -0000	1.3
@@ -0,0 +1,13 @@
+diff --git a/mm/vmscan.c b/mm/vmscan.c
+index 3fce32b..09c804c 100644
+--- a/mm/vmscan.c
++++ b/mm/vmscan.c
+@@ -127,7 +127,7 @@ struct scan_control {
+ /*
+  * From 0 .. 100.  Higher means more swappy.
+  */
+-int vm_swappiness = 60;
++int vm_swappiness = 40;
+ long vm_total_pages;	/* The total number of pages which the VM controls */
+ 
+ static LIST_HEAD(shrinker_list);

linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch:
 vmscan.c |   33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

Index: linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch
===================================================================
RCS file: linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch
diff -N linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch	10 Aug 2009 20:18:34 -0000	1.4
@@ -0,0 +1,90 @@
+vmscan: make mapped executable pages the first class citizen
+
+Protect referenced PROT_EXEC mapped pages from being deactivated.
+
+PROT_EXEC(or its internal presentation VM_EXEC) pages normally belong to some
+currently running executables and their linked libraries, they shall really be
+cached aggressively to provide good user experiences.
+
+CC: Elladan <elladan at eskimo.com>
+CC: Nick Piggin <npiggin at suse.de>
+CC: Johannes Weiner <hannes at cmpxchg.org>
+CC: Christoph Lameter <cl at linux-foundation.org>
+CC: KOSAKI Motohiro <kosaki.motohiro at jp.fujitsu.com>
+Acked-by: Peter Zijlstra <peterz at infradead.org>
+Acked-by: Rik van Riel <riel at redhat.com>
+Signed-off-by: Wu Fengguang <fengguang.wu at intel.com>
+---
+diff --git a/mm/vmscan.c b/mm/vmscan.c
+index f322f31..3fce32b 100644
+--- a/mm/vmscan.c
++++ b/mm/vmscan.c
+@@ -1228,6 +1228,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
+ 	unsigned long pgscanned;
+ 	unsigned long vm_flags;
+ 	LIST_HEAD(l_hold);	/* The pages which were snipped off */
++	LIST_HEAD(l_active);
+ 	LIST_HEAD(l_inactive);
+ 	struct page *page;
+ 	struct pagevec pvec;
+@@ -1267,8 +1268,13 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
+ 
+ 		/* page_referenced clears PageReferenced */
+ 		if (page_mapping_inuse(page) &&
+-		    page_referenced(page, 0, sc->mem_cgroup, &vm_flags))
++		    page_referenced(page, 0, sc->mem_cgroup, &vm_flags)) {
+ 			pgmoved++;
++			if ((vm_flags & VM_EXEC) && !PageAnon(page)) {
++				list_add(&page->lru, &l_active);
++				continue;
++			}
++		}
+ 
+ 		list_add(&page->lru, &l_inactive);
+ 	}
+@@ -1277,7 +1283,6 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
+ 	 * Move the pages to the [file or anon] inactive list.
+ 	 */
+ 	pagevec_init(&pvec, 1);
+-	lru = LRU_BASE + file * LRU_FILE;
+ 
+ 	spin_lock_irq(&zone->lru_lock);
+ 	/*
+@@ -1289,6 +1294,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
+ 	reclaim_stat->recent_rotated[!!file] += pgmoved;
+ 
+ 	pgmoved = 0;
++	lru = LRU_BASE + file * LRU_FILE;
+ 	while (!list_empty(&l_inactive)) {
+ 		page = lru_to_page(&l_inactive);
+ 		prefetchw_prev_lru_page(page, &l_inactive, flags);
+@@ -1315,6 +1321,29 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
+ 	pgdeactivate += pgmoved;
+ 	__count_zone_vm_events(PGREFILL, zone, pgscanned);
+ 	__count_vm_events(PGDEACTIVATE, pgdeactivate);
++
++	pgmoved = 0;  /* count pages moved back to active list */
++	lru = LRU_ACTIVE + file * LRU_FILE;
++	while (!list_empty(&l_active)) {
++		page = lru_to_page(&l_active);
++		prefetchw_prev_lru_page(page, &l_active, flags);
++		VM_BUG_ON(PageLRU(page));
++		SetPageLRU(page);
++		VM_BUG_ON(!PageActive(page));
++
++		list_move(&page->lru, &zone->lru[lru].list);
++		mem_cgroup_add_lru_list(page, lru);
++		pgmoved++;
++		if (!pagevec_add(&pvec, page)) {
++			spin_unlock_irq(&zone->lru_lock);
++			if (buffer_heads_over_limit)
++				pagevec_strip(&pvec);
++			__pagevec_release(&pvec);
++			spin_lock_irq(&zone->lru_lock);
++		}
++	}
++	__mod_zone_page_state(zone, NR_LRU_BASE + lru, pgmoved);
++
+ 	spin_unlock_irq(&zone->lru_lock);
+ 	if (buffer_heads_over_limit)
+ 		pagevec_strip(&pvec);

linux-2.6-mm-lru-evict-streaming-io-pages-first.patch:
 include/linux/memcontrol.h |    7 +++++++
 mm/memcontrol.c            |   11 +++++++++++
 mm/vmscan.c                |   38 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 55 insertions(+), 1 deletion(-)

Index: linux-2.6-mm-lru-evict-streaming-io-pages-first.patch
===================================================================
RCS file: linux-2.6-mm-lru-evict-streaming-io-pages-first.patch
diff -N linux-2.6-mm-lru-evict-streaming-io-pages-first.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-mm-lru-evict-streaming-io-pages-first.patch	10 Aug 2009 20:18:34 -0000	1.4
@@ -0,0 +1,119 @@
+When the file LRU lists are dominated by streaming IO pages,
+evict those pages first, before considering evicting other
+pages.
+
+This should be safe from deadlocks or performance problems
+because only three things can happen to an inactive file page:
+1) referenced twice and promoted to the active list
+2) evicted by the pageout code
+3) under IO, after which it will get evicted or promoted
+
+The pages freed in this way can either be reused for streaming
+IO, or allocated for something else. If the pages are used for
+streaming IO, this pageout pattern continues. Otherwise, we will
+fall back to the normal pageout pattern.
+
+Signed-off-by: Rik van Riel <riel redhat com>
+
+---
+diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
+index 25b9ca9..45add35 100644
+--- a/include/linux/memcontrol.h
++++ b/include/linux/memcontrol.h
+@@ -94,6 +94,7 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
+ extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
+ 							int priority);
+ int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
++int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
+ unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
+ 				       struct zone *zone,
+ 				       enum lru_list lru);
+@@ -239,6 +240,12 @@ mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
+ 	return 1;
+ }
+ 
++static inline int
++mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
++{
++	return 1;
++}
++
+ static inline unsigned long
+ mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
+ 			 enum lru_list lru)
+diff --git a/mm/memcontrol.c b/mm/memcontrol.c
+index 78eb855..f4e9f51 100644
+--- a/mm/memcontrol.c
++++ b/mm/memcontrol.c
+@@ -570,6 +570,17 @@ int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
+ 	return 0;
+ }
+ 
++int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
++{
++	unsigned long active;
++	unsigned long inactive;
++
++	inactive = mem_cgroup_get_all_zonestat(memcg, LRU_INACTIVE_FILE);
++	active = mem_cgroup_get_all_zonestat(memcg, LRU_ACTIVE_FILE);
++
++	return (active > inactive);
++}
++
+ unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
+ 				       struct zone *zone,
+ 				       enum lru_list lru)
+diff --git a/mm/vmscan.c b/mm/vmscan.c
+index b3e39b5..3584da9 100644
+--- a/mm/vmscan.c
++++ b/mm/vmscan.c
+@@ -1350,12 +1350,48 @@ static int inactive_anon_is_low(struct zone *zone, struct scan_control *sc)
+ 	return low;
+ }
+ 
++static int inactive_file_is_low_global(struct zone *zone)
++{
++	unsigned long active, inactive;
++
++	active = zone_page_state(zone, NR_ACTIVE_FILE);
++	inactive = zone_page_state(zone, NR_INACTIVE_FILE);
++
++	return (active > inactive);
++}
++
++/**
++ * inactive_file_is_low - check if file pages need to be deactivated
++ * @zone: zone to check
++ * @sc:   scan control of this context
++ *
++ * When the system is doing streaming IO, memory pressure here
++ * ensures that active file pages get deactivated, until more
++ * than half of the file pages are on the inactive list.
++ *
++ * Once we get to that situation, protect the system's working
++ * set from being evicted by disabling active file page aging.
++ *
++ * This uses a different ratio than the anonymous pages, because
++ * the page cache uses a use-once replacement algorithm.
++ */
++static int inactive_file_is_low(struct zone *zone, struct scan_control *sc)
++{
++	int low;
++
++	if (scanning_global_lru(sc))
++		low = inactive_file_is_low_global(zone);
++	else
++		low = mem_cgroup_inactive_file_is_low(sc->mem_cgroup);
++	return low;
++}
++
+ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
+ 	struct zone *zone, struct scan_control *sc, int priority)
+ {
+ 	int file = is_file_lru(lru);
+ 
+-	if (lru == LRU_ACTIVE_FILE) {
++	if (lru == LRU_ACTIVE_FILE && inactive_file_is_low(zone, sc)) {
+ 		shrink_active_list(nr_to_scan, zone, sc, priority, file);
+ 		return 0;
+ 	}

linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch:
 include/linux/rmap.h |    5 +++--
 mm/rmap.c            |   30 +++++++++++++++++++++---------
 mm/vmscan.c          |    7 +++++--
 3 files changed, 29 insertions(+), 13 deletions(-)

Index: linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch
===================================================================
RCS file: linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch
diff -N linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch	10 Aug 2009 20:18:34 -0000	1.3
@@ -0,0 +1,169 @@
+vmscan: report vm_flags in page_referenced()
+
+This enables more informed reclaim heuristics, eg. to protect executable
+file pages more aggressively.
+
+Signed-off-by: Wu Fengguang <fengguang.wu at intel.com>
+---
+diff --git a/include/linux/rmap.h b/include/linux/rmap.h
+index b35bc0e..4e1c961 100644
+--- a/include/linux/rmap.h
++++ b/include/linux/rmap.h
+@@ -83,7 +83,8 @@ static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma,
+ /*
+  * Called from mm/vmscan.c to handle paging out
+  */
+-int page_referenced(struct page *, int is_locked, struct mem_cgroup *cnt);
++int page_referenced(struct page *, int is_locked,
++			struct mem_cgroup *cnt, unsigned long *vm_flags);
+ int try_to_unmap(struct page *, int ignore_refs);
+ 
+ /*
+@@ -124,7 +125,7 @@ static inline int try_to_munlock(struct page *page)
+ #define anon_vma_prepare(vma)	(0)
+ #define anon_vma_link(vma)	do {} while (0)
+ 
+-#define page_referenced(page,l,cnt) TestClearPageReferenced(page)
++#define page_referenced(page, locked, cnt, flags) TestClearPageReferenced(page)
+ #define try_to_unmap(page, refs) SWAP_FAIL
+ 
+ static inline int page_mkclean(struct page *page)
+diff --git a/mm/rmap.c b/mm/rmap.c
+index 23122af..831d2cc 100644
+--- a/mm/rmap.c
++++ b/mm/rmap.c
+@@ -333,7 +333,8 @@ static int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
+  * repeatedly from either page_referenced_anon or page_referenced_file.
+  */
+ static int page_referenced_one(struct page *page,
+-	struct vm_area_struct *vma, unsigned int *mapcount)
++			       struct vm_area_struct *vma,
++			       unsigned int *mapcount)
+ {
+ 	struct mm_struct *mm = vma->vm_mm;
+ 	unsigned long address;
+@@ -385,7 +386,8 @@ out:
+ }
+ 
+ static int page_referenced_anon(struct page *page,
+-				struct mem_cgroup *mem_cont)
++				struct mem_cgroup *mem_cont,
++				unsigned long *vm_flags)
+ {
+ 	unsigned int mapcount;
+ 	struct anon_vma *anon_vma;
+@@ -406,6 +408,7 @@ static int page_referenced_anon(struct page *page,
+ 		if (mem_cont && !mm_match_cgroup(vma->vm_mm, mem_cont))
+ 			continue;
+ 		referenced += page_referenced_one(page, vma, &mapcount);
++		*vm_flags |= vma->vm_flags;
+ 		if (!mapcount)
+ 			break;
+ 	}
+@@ -418,6 +421,7 @@ static int page_referenced_anon(struct page *page,
+  * page_referenced_file - referenced check for object-based rmap
+  * @page: the page we're checking references on.
+  * @mem_cont: target memory controller
++ * @vm_flags: collect the encountered vma->vm_flags
+  *
+  * For an object-based mapped page, find all the places it is mapped and
+  * check/clear the referenced flag.  This is done by following the page->mapping
+@@ -427,7 +431,8 @@ static int page_referenced_anon(struct page *page,
+  * This function is only called from page_referenced for object-based pages.
+  */
+ static int page_referenced_file(struct page *page,
+-				struct mem_cgroup *mem_cont)
++				struct mem_cgroup *mem_cont,
++				unsigned long *vm_flags)
+ {
+ 	unsigned int mapcount;
+ 	struct address_space *mapping = page->mapping;
+@@ -468,6 +473,7 @@ static int page_referenced_file(struct page *page,
+ 		if (mem_cont && !mm_match_cgroup(vma->vm_mm, mem_cont))
+ 			continue;
+ 		referenced += page_referenced_one(page, vma, &mapcount);
++		*vm_flags |= vma->vm_flags;
+ 		if (!mapcount)
+ 			break;
+ 	}
+@@ -481,29 +487,35 @@ static int page_referenced_file(struct page *page,
+  * @page: the page to test
+  * @is_locked: caller holds lock on the page
+  * @mem_cont: target memory controller
++ * @vm_flags: collect the encountered vma->vm_flags
+  *
+  * Quick test_and_clear_referenced for all mappings to a page,
+  * returns the number of ptes which referenced the page.
+  */
+-int page_referenced(struct page *page, int is_locked,
+-			struct mem_cgroup *mem_cont)
++int page_referenced(struct page *page,
++		    int is_locked,
++		    struct mem_cgroup *mem_cont,
++		    unsigned long *vm_flags)
+ {
+ 	int referenced = 0;
+ 
+ 	if (TestClearPageReferenced(page))
+ 		referenced++;
+ 
++	*vm_flags = 0;
+ 	if (page_mapped(page) && page->mapping) {
+ 		if (PageAnon(page))
+-			referenced += page_referenced_anon(page, mem_cont);
++			referenced += page_referenced_anon(page, mem_cont,
++								vm_flags);
+ 		else if (is_locked)
+-			referenced += page_referenced_file(page, mem_cont);
++			referenced += page_referenced_file(page, mem_cont,
++								vm_flags);
+ 		else if (!trylock_page(page))
+ 			referenced++;
+ 		else {
+ 			if (page->mapping)
+-				referenced +=
+-					page_referenced_file(page, mem_cont);
++				referenced += page_referenced_file(page,
++							mem_cont, vm_flags);
+ 			unlock_page(page);
+ 		}
+ 	}
+diff --git a/mm/vmscan.c b/mm/vmscan.c
+index 3584da9..f322f31 100644
+--- a/mm/vmscan.c
++++ b/mm/vmscan.c
+@@ -593,6 +593,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
+ 	struct pagevec freed_pvec;
+ 	int pgactivate = 0;
+ 	unsigned long nr_reclaimed = 0;
++	unsigned long vm_flags;
+ 
+ 	cond_resched();
+ 
+@@ -643,7 +644,8 @@ static unsigned long shrink_page_list(struct list_head *page_list,
+ 				goto keep_locked;
+ 		}
+ 
+-		referenced = page_referenced(page, 1, sc->mem_cgroup);
++		referenced = page_referenced(page, 1,
++						sc->mem_cgroup, &vm_flags);
+ 		/* In active use or really unfreeable?  Activate it. */
+ 		if (sc->order <= PAGE_ALLOC_COSTLY_ORDER &&
+ 					referenced && page_mapping_inuse(page))
+@@ -1224,6 +1226,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
+ 	unsigned long pgmoved;
+ 	int pgdeactivate = 0;
+ 	unsigned long pgscanned;
++	unsigned long vm_flags;
+ 	LIST_HEAD(l_hold);	/* The pages which were snipped off */
+ 	LIST_HEAD(l_inactive);
+ 	struct page *page;
+@@ -1264,7 +1267,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
+ 
+ 		/* page_referenced clears PageReferenced */
+ 		if (page_mapping_inuse(page) &&
+-		    page_referenced(page, 0, sc->mem_cgroup))
++		    page_referenced(page, 0, sc->mem_cgroup, &vm_flags))
+ 			pgmoved++;
+ 
+ 		list_add(&page->lru, &l_inactive);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1697
retrieving revision 1.1698
diff -u -p -r1.1697 -r1.1698
--- kernel.spec	10 Aug 2009 19:54:25 -0000	1.1697
+++ kernel.spec	10 Aug 2009 20:18:34 -0000	1.1698
@@ -595,6 +595,11 @@ Patch22: linux-2.6-utrace.patch
 
 Patch41: linux-2.6-sysrq-c.patch
 
+Patch80: linux-2.6-defaults-saner-vm-settings.patch
+Patch81: linux-2.6-mm-lru-evict-streaming-io-pages-first.patch
+Patch82: linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch
+Patch83: linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch
+
 Patch141: linux-2.6-ps3-storage-alias.patch
 Patch143: linux-2.6-g5-therm-shutdown.patch
 Patch144: linux-2.6-vio-modalias.patch
@@ -1098,7 +1103,11 @@ ApplyPatch linux-2.6-hotfixes.patch
 ApplyPatch linux-2.6-tracehook.patch
 ApplyPatch linux-2.6-utrace.patch
 
-# VM patches
+# mm patches
+ApplyPatch linux-2.6-defaults-saner-vm-settings.patch
+ApplyPatch linux-2.6-mm-lru-evict-streaming-io-pages-first.patch
+ApplyPatch linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch
+ApplyPatch linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch
 
 # iommu patches
 
@@ -1872,6 +1881,10 @@ fi
  - linux-2.6-drivers-char-low-latency-removal.patch
  - linux-2.6-serial-add-txen-test-param.patch
  - linux-2.6-input-wacom-bluetooth.patch
+ - linux-2.6-defaults-saner-vm-settings.patch
+ - linux-2.6-mm-lru-evict-streaming-io-pages-first.patch
+ - linux-2.6-mm-lru-report-vm-flags-in-page-referenced.patch
+ - linux-2.6-mm-lru-dont-evict-mapped-executable-pages.patch
 
 * Wed Aug 05 2009 Kyle McMartin <kyle at redhat.com>
 - Update to released 2.6.30.4.




More information about the fedora-extras-commits mailing list