Displaying 18 results from an estimated 18 matches for "page_host_discards".
2007 Apr 18
4
[patch 3/9] Guest page hinting: volatile page cache.
...ates.h linux-2.6-patched/include/linux/page-states.h
--- linux-2.6/include/linux/page-states.h	2006-09-01 12:49:36.000000000 +0200
+++ linux-2.6-patched/include/linux/page-states.h	2006-09-01 12:49:36.000000000 +0200
@@ -16,17 +16,72 @@
 #else
 
 /* Guest page hinting architecture primitives:
+ * - page_host_discards:
+ *     Indicates whether the host system discards guest pages or not.
  * - page_set_unused:
  *     Indicates to the host that the page content is of no interest
  *     to the guest. The host can "forget" the page content and replace
  *     it with a page containing zeroes.
  * - pag...
2007 Apr 18
4
[patch 3/9] Guest page hinting: volatile page cache.
...ates.h linux-2.6-patched/include/linux/page-states.h
--- linux-2.6/include/linux/page-states.h	2006-09-01 12:49:36.000000000 +0200
+++ linux-2.6-patched/include/linux/page-states.h	2006-09-01 12:49:36.000000000 +0200
@@ -16,17 +16,72 @@
 #else
 
 /* Guest page hinting architecture primitives:
+ * - page_host_discards:
+ *     Indicates whether the host system discards guest pages or not.
  * - page_set_unused:
  *     Indicates to the host that the page content is of no interest
  *     to the guest. The host can "forget" the page content and replace
  *     it with a page containing zeroes.
  * - pag...
2007 Apr 18
1
[patch 8/9] Guest page hinting: discarded page list.
...+		return;
+	spin_lock(&splice_lock);
+	list_splice_init(cpu_list, discard_list);
+	spin_unlock(&splice_lock);
+}
+
+unsigned long page_shrink_discards(void)
+{
+	struct list_head pages_to_free = LIST_HEAD_INIT(pages_to_free);
+	struct page *page, *next;
+	unsigned long freed = 0;
+
+	if (!page_host_discards())
+		return 0;
+
+	on_each_cpu(__page_shrink_discards, &pages_to_free, 0, 1);
+
+	list_for_each_entry_safe(page, next, &pages_to_free, lru) {
+		ClearPageDiscarded(page);
+		free_cold_page(page);
+		freed++;
+	}
+	return freed;
+}
+#endif
+
 /*
  * Free a 0-order page
  */
@@ -795,6 +831,1...
2007 Apr 18
1
[patch 8/9] Guest page hinting: discarded page list.
...+		return;
+	spin_lock(&splice_lock);
+	list_splice_init(cpu_list, discard_list);
+	spin_unlock(&splice_lock);
+}
+
+unsigned long page_shrink_discards(void)
+{
+	struct list_head pages_to_free = LIST_HEAD_INIT(pages_to_free);
+	struct page *page, *next;
+	unsigned long freed = 0;
+
+	if (!page_host_discards())
+		return 0;
+
+	on_each_cpu(__page_shrink_discards, &pages_to_free, 0, 1);
+
+	list_for_each_entry_safe(page, next, &pages_to_free, lru) {
+		ClearPageDiscarded(page);
+		free_cold_page(page);
+		freed++;
+	}
+	return freed;
+}
+#endif
+
 /*
  * Free a 0-order page
  */
@@ -795,6 +831,1...
2007 Apr 18
1
[patch 5/9] Guest page hinting: mlocked pages.
...memory.c	2006-09-01 12:50:24.000000000 +0200
+++ linux-2.6-patched/mm/memory.c	2006-09-01 12:50:24.000000000 +0200
@@ -2523,6 +2523,31 @@ int make_pages_present(unsigned long add
 	BUG_ON(addr >= end);
 	BUG_ON(end > vma->vm_end);
 	len = (end+PAGE_SIZE-1)/PAGE_SIZE-addr/PAGE_SIZE;
+
+	if (page_host_discards() && (vma->vm_flags & VM_LOCKED)) {
+		int rlen = len;
+		ret = 0;
+		while (rlen > 0) {
+			struct page *page_refs[32];
+			int chunk, cret, i;
+
+			chunk = rlen < 32 ? rlen : 32;
+			cret = get_user_pages(current, current->mm, addr,
+					      chunk, write, 0,
+...
2007 Apr 18
1
[patch 5/9] Guest page hinting: mlocked pages.
...memory.c	2006-09-01 12:50:24.000000000 +0200
+++ linux-2.6-patched/mm/memory.c	2006-09-01 12:50:24.000000000 +0200
@@ -2523,6 +2523,31 @@ int make_pages_present(unsigned long add
 	BUG_ON(addr >= end);
 	BUG_ON(end > vma->vm_end);
 	len = (end+PAGE_SIZE-1)/PAGE_SIZE-addr/PAGE_SIZE;
+
+	if (page_host_discards() && (vma->vm_flags & VM_LOCKED)) {
+		int rlen = len;
+		ret = 0;
+		while (rlen > 0) {
+			struct page *page_refs[32];
+			int chunk, cret, i;
+
+			chunk = rlen < 32 ? rlen : 32;
+			cret = get_user_pages(current, current->mm, addr,
+					      chunk, write, 0,
+...
2007 Apr 18
0
[patch 6/9] Guest page hinting: writable page table entries.
...page *page);
diff -urpN linux-2.6/include/linux/page-states.h linux-2.6-patched/include/linux/page-states.h
--- linux-2.6/include/linux/page-states.h	2006-09-01 12:50:23.000000000 +0200
+++ linux-2.6-patched/include/linux/page-states.h	2006-09-01 12:50:24.000000000 +0200
@@ -40,7 +40,7 @@
 #define page_host_discards()			(0)
 #define page_set_unused(_page,_order)		do { } while (0)
 #define page_set_stable(_page,_order)		do { } while (0)
-#define page_set_volatile(_page)		do { } while (0)
+#define page_set_volatile(_page,_writable)	do { } while (0)
 #define page_set_stable_if_present(_page)	(1)
 #define page_dis...
2007 Apr 18
0
[patch 6/9] Guest page hinting: writable page table entries.
...page *page);
diff -urpN linux-2.6/include/linux/page-states.h linux-2.6-patched/include/linux/page-states.h
--- linux-2.6/include/linux/page-states.h	2006-09-01 12:50:23.000000000 +0200
+++ linux-2.6-patched/include/linux/page-states.h	2006-09-01 12:50:24.000000000 +0200
@@ -40,7 +40,7 @@
 #define page_host_discards()			(0)
 #define page_set_unused(_page,_order)		do { } while (0)
 #define page_set_stable(_page,_order)		do { } while (0)
-#define page_set_volatile(_page)		do { } while (0)
+#define page_set_volatile(_page,_writable)	do { } while (0)
 #define page_set_stable_if_present(_page)	(1)
 #define page_dis...
2007 Apr 18
2
[patch 4/9] Guest page hinting: volatile swap cache.
...0:23.000000000 +0200
@@ -2064,8 +2064,16 @@ static int do_swap_page(struct mm_struct
 	unlock_page(page);
 
 	if (write_access) {
-		if (do_wp_page(mm, vma, address,
-				page_table, pmd, ptl, pte) == VM_FAULT_OOM)
+		int rc = do_wp_page(mm, vma, address, page_table,
+				    pmd, ptl, pte);
+		if (page_host_discards() && rc == VM_FAULT_MAJOR)
+			/*
+			 * A discard removed the page, and do_wp_page called
+			 * page_discard which removed the pte as well.
+			 * handle_pte_fault needs to be repeated.
+			 */
+			ret = VM_FAULT_MINOR;
+		else if (rc == VM_FAULT_OOM)
 			ret = VM_FAULT_OOM;
 		goto out;...
2007 Apr 18
2
[patch 4/9] Guest page hinting: volatile swap cache.
...0:23.000000000 +0200
@@ -2064,8 +2064,16 @@ static int do_swap_page(struct mm_struct
 	unlock_page(page);
 
 	if (write_access) {
-		if (do_wp_page(mm, vma, address,
-				page_table, pmd, ptl, pte) == VM_FAULT_OOM)
+		int rc = do_wp_page(mm, vma, address, page_table,
+				    pmd, ptl, pte);
+		if (page_host_discards() && rc == VM_FAULT_MAJOR)
+			/*
+			 * A discard removed the page, and do_wp_page called
+			 * page_discard which removed the pte as well.
+			 * handle_pte_fault needs to be repeated.
+			 */
+			ret = VM_FAULT_MINOR;
+		else if (rc == VM_FAULT_OOM)
 			ret = VM_FAULT_OOM;
 		goto out;...
2007 Apr 18
0
[patch 7/9] Guest page hinting: minor fault optimization.
...-2039,7 +2039,8 @@ static int do_swap_page(struct mm_struct
 	 * Back out if somebody else already faulted in this pte.
 	 */
 	page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
-	if (unlikely(!pte_same(*page_table, orig_pte)))
+	if (unlikely(!pte_same(*page_table, orig_pte) ||
+		     (page_host_discards() && PageDiscarded(page))))
 		goto out_nomap;
 
 	if (unlikely(!PageUptodate(page))) {
@@ -2267,7 +2268,8 @@ retry:
 	 * handle that later.
 	 */
 	/* Only go through if we didn't race with anybody else... */
-	if (pte_none(*page_table)) {
+	if (pte_none(*page_table) &&
+	    !...
2007 Apr 18
0
[patch 7/9] Guest page hinting: minor fault optimization.
...-2039,7 +2039,8 @@ static int do_swap_page(struct mm_struct
 	 * Back out if somebody else already faulted in this pte.
 	 */
 	page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
-	if (unlikely(!pte_same(*page_table, orig_pte)))
+	if (unlikely(!pte_same(*page_table, orig_pte) ||
+		     (page_host_discards() && PageDiscarded(page))))
 		goto out_nomap;
 
 	if (unlikely(!PageUptodate(page))) {
@@ -2267,7 +2268,8 @@ retry:
 	 * handle that later.
 	 */
 	/* Only go through if we didn't race with anybody else... */
-	if (pte_none(*page_table)) {
+	if (pte_none(*page_table) &&
+	    !...
2007 May 11
6
[patch 0/6] [rfc] guest page hinting version 5
After way to many months here is the fifth version of the guest page
hinting patches. Compared to version four a few improvements have been
added:
 - Avoid page_host_discards() calls outside of page-states.h
 - The discard list is now implemented via the page_free_discarded
   hook and architecture specific code.
 - PG_state_change page flag has been replaced with architecture
   specficic primitives. s390 now uses PG_arch_1 and avoids to waste
   another page flag (it...
2007 May 11
6
[patch 0/6] [rfc] guest page hinting version 5
After way to many months here is the fifth version of the guest page
hinting patches. Compared to version four a few improvements have been
added:
 - Avoid page_host_discards() calls outside of page-states.h
 - The discard list is now implemented via the page_free_discarded
   hook and architecture specific code.
 - PG_state_change page flag has been replaced with architecture
   specficic primitives. s390 now uses PG_arch_1 and avoids to waste
   another page flag (it...
2007 Jun 28
6
[patch 0/6] resend: guest page hinting version 5.
Greetings,
after Carsten pitched CMM2 on the kvm mini summit here is a repost
of version 5 of the guest page hinting patches. The code is still
the same but has been adapted to the latest git level.
-- 
blue skies,
   Martin.
"Reality continues to ruin my life." - Calvin.
2007 Jun 28
6
[patch 0/6] resend: guest page hinting version 5.
Greetings,
after Carsten pitched CMM2 on the kvm mini summit here is a repost
of version 5 of the guest page hinting patches. The code is still
the same but has been adapted to the latest git level.
-- 
blue skies,
   Martin.
"Reality continues to ruin my life." - Calvin.
2007 Apr 18
0
[patch 9/9] Guest page hinting: full s390 support.
...inux-2.6-patched/include/asm-s390/page-states.h
--- linux-2.6/include/asm-s390/page-states.h	2006-09-01 12:49:36.000000000 +0200
+++ linux-2.6-patched/include/asm-s390/page-states.h	2006-09-01 12:50:25.000000000 +0200
@@ -33,6 +33,22 @@ extern struct page *mem_map;
 	_rc; \
 })
 
+static inline int page_host_discards(void)
+{
+	return MACHINE_HAS_ESSA;
+}
+
+static inline int page_discarded(struct page *page)
+{
+	int state;
+
+	if (!MACHINE_HAS_ESSA)
+		return 0;
+	state = page_essa(page, ESSA_GET_STATE);
+	return (state & ESSA_USTATE_MASK) == ESSA_USTATE_VOLATILE &&
+		(state & ESSA_CSTATE_MAS...
2007 Apr 18
0
[patch 9/9] Guest page hinting: full s390 support.
...inux-2.6-patched/include/asm-s390/page-states.h
--- linux-2.6/include/asm-s390/page-states.h	2006-09-01 12:49:36.000000000 +0200
+++ linux-2.6-patched/include/asm-s390/page-states.h	2006-09-01 12:50:25.000000000 +0200
@@ -33,6 +33,22 @@ extern struct page *mem_map;
 	_rc; \
 })
 
+static inline int page_host_discards(void)
+{
+	return MACHINE_HAS_ESSA;
+}
+
+static inline int page_discarded(struct page *page)
+{
+	int state;
+
+	if (!MACHINE_HAS_ESSA)
+		return 0;
+	state = page_essa(page, ESSA_GET_STATE);
+	return (state & ESSA_USTATE_MASK) == ESSA_USTATE_VOLATILE &&
+		(state & ESSA_CSTATE_MAS...