[RHEL7,COMMIT] Revert "ve/fs/fadvise: introduce FADV_DEACTIVATE flag"

Submitted by Konstantin Khorenko on Oct. 22, 2019, 1:03 p.m.

Details

Message ID 201910221303.x9MD3OX5025556@finist-ce7.sw.ru
State New
Series "fs/fadvise: introduce FADV_DEACTIVATE flag"
Headers show

Commit Message

Konstantin Khorenko Oct. 22, 2019, 1:03 p.m.
The commit is pushed to "branch-rh7-3.10.0-1062.1.2.vz7.114.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.1.2.vz7.114.8
------>
commit b4f99d63887beeb1eedc3a49078845f92bee229d
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date:   Tue Oct 22 16:01:15 2019 +0300

    Revert "ve/fs/fadvise: introduce FADV_DEACTIVATE flag"
    
    This reverts commit 114935b7b36b5d228fdce234f885701fe53774b2.
    
    Drop our home brew fadvise FADV_DEACTIVATE flag which was introduced in
    the scope of
    https://jira.sw.ru/browse/PSBM-57915
    
    Reasoning: it won't be used because of performance degradation:
    https://pmc.acronis.com/browse/VSTOR-22963
    
    https://jira.sw.ru/browse/PSBM-94829
    
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 include/uapi/linux/fadvise.h |  1 -
 mm/fadvise.c                 | 43 -------------------------------------------
 2 files changed, 44 deletions(-)

Patch hide | download patch | download mbox

diff --git a/include/uapi/linux/fadvise.h b/include/uapi/linux/fadvise.h
index b6ade7ef8cc4..a3e0703f475d 100644
--- a/include/uapi/linux/fadvise.h
+++ b/include/uapi/linux/fadvise.h
@@ -17,7 +17,6 @@ 
 #define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
 #define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
-#define FADV_DEACTIVATE		32 /* Mark pages as good candidates for reclaim */
 
 #ifdef __KERNEL__
 extern int generic_fadvise(struct file* file, loff_t off, loff_t len, int adv);
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 50beef36598a..0b25007bf488 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -22,43 +22,6 @@ 
 
 #include <asm/unistd.h>
 
-static void fadvise_deactivate(struct address_space *mapping,
-		pgoff_t start, pgoff_t end)
-{
-	struct pagevec pvec;
-	pgoff_t index = start;
-	int i;
-
-	if (start > end)
-		return;
-
-	/*
-	 * Note: this function may get called on a shmem/tmpfs mapping:
-	 * pagevec_lookup() might then return 0 prematurely (because it
-	 * got a gangful of swap entries); but it's hardly worth worrying
-	 * about - it can rarely have anything to free from such a mapping
-	 * (most pages are dirty), and already skips over any difficulties.
-	 */
-
-	pagevec_init(&pvec, 0);
-	while (index <= end && pagevec_lookup(&pvec, mapping, index,
-			min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {
-		for (i = 0; i < pagevec_count(&pvec); i++) {
-			struct page *page = pvec.pages[i];
-
-			/* We rely upon deletion not changing page->index */
-			index = page->index;
-			if (index > end)
-				break;
-
-			deactivate_page(page);
-		}
-		pagevec_release(&pvec);
-		cond_resched();
-		index++;
-	}
-}
-
 /*
  * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
  * deactivate the pages and clear PG_Referenced.
@@ -84,7 +47,6 @@  int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
 		case POSIX_FADV_WILLNEED:
 		case POSIX_FADV_NOREUSE:
 		case POSIX_FADV_DONTNEED:
-		case FADV_DEACTIVATE:
 			/* no bad return value, but ignore advice */
 			break;
 		default:
@@ -165,11 +127,6 @@  int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
 			}
 		}
 		break;
-	case FADV_DEACTIVATE:
-		start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT;
-		end_index = (endbyte >> PAGE_CACHE_SHIFT);
-		fadvise_deactivate(mapping, start_index, end_index);
-		break;
 	default:
 		ret = -EINVAL;
 	}