[RHEL7,COMMIT] Revert "ve/fs/files: always try to shrink big fdtables, not only on CT restore"

Submitted by Konstantin Khorenko on March 5, 2018, 3:08 p.m.

Details

Message ID 201803051508.w25F8iwW017151@finist_ce7.work
State New
Series "Revert "ve/fs/files: always try to shrink big fdtables, not only on CT restore""
Headers show

Commit Message

Konstantin Khorenko March 5, 2018, 3:08 p.m.
The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.45.7
------>
commit 91dc857c07cc6f3a9ef18ca90397e783d3cbab2e
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date:   Mon Mar 5 18:06:10 2018 +0300

    Revert "ve/fs/files: always try to shrink big fdtables, not only on CT restore"
    
    This reverts commit 23c7ef099f7a318a022287471fa860a18cc3f076.
    
    So we've tested the functionality of shrinking big fd tables,
    no issues were found, so we can safely use it.
    Now we we use this functionality only during CRIU restore stage
    where it's vital.
    
    https://jira.sw.ru/browse/PSBM-80715
    
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 fs/file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/file.c b/fs/file.c
index 2dbac23ebefe..b85e8ee6143b 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -663,7 +663,9 @@  int __close_fd(struct files_struct *files, unsigned fd)
 
 	/* Try to shrink fdt and to free memory */
 	if (unlikely(fd * 2 >= fdt->max_fds &&
-		     fd > (1024 / sizeof(struct file *))))
+		     fd > (1024 / sizeof(struct file *))) &&
+		     get_exec_env() != get_ve0() &&
+		     get_exec_env()->is_pseudosuper)
 		expand_files(files, fd, true);
 
 	spin_unlock(&files->file_lock);