diff --git a/src/app/fdctl/configure/hugetlbfs.c b/src/app/fdctl/configure/hugetlbfs.c index c5246e8925..fbe28468a9 100644 --- a/src/app/fdctl/configure/hugetlbfs.c +++ b/src/app/fdctl/configure/hugetlbfs.c @@ -20,15 +20,6 @@ fini_perm( fd_caps_ctx_t * caps, (void)config; fd_caps_check_root( caps, "hugetlbfs", "remove directories from `/mnt`" ); fd_caps_check_capability( caps, "hugetlbfs", CAP_SYS_ADMIN, "unmount hugetlbfs filesystems" ); - -} - -void -try_defragment_memory( void ) { - write_uint_file( "/proc/sys/vm/compact_memory", 1 ); - /* Sleep a little to give the OS some time to perform the - compaction. */ - nanosleep1( 0, 250000000 /* 250 millis */ ); } static const char * ERR_MSG = "please confirm your host is configured for gigantic pages,"; @@ -74,7 +65,6 @@ init( config_t * const config ) { /* There is a TOCTOU race condition here, but it's not avoidable. There's no way to atomically increment the page count. */ - try_defragment_memory(); FD_TEST( required_pages[ j ]<=UINT_MAX ); if( FD_UNLIKELY( free_pages %s`", (uint)(total_pages+additional_pages_needed), total_page_path )); write_uint_file( total_page_path, (uint)(total_pages+additional_pages_needed) ); uint raised_free_pages = read_uint_file( free_page_path, ERR_MSG ); - if( FD_UNLIKELY( raised_free_pages /proc/sys/vm/compact_memory" )); + write_uint_file( "/proc/sys/vm/compact_memory", 1 ); + /* Sleep a little to give the OS some time to perform the + compaction. */ + nanosleep1( 0, 500000000 /* 500 millis */ ); + FD_LOG_NOTICE(( "RUN: `echo \"3\" > /proc/sys/vm/drop_caches" )); + write_uint_file( "/proc/sys/vm/drop_caches", 3 ); + nanosleep1( 0, 500000000 /* 500 millis */ ); + FD_LOG_NOTICE(( "RUN: `echo \"1\" > /proc/sys/vm/compact_memory" )); + write_uint_file( "/proc/sys/vm/compact_memory", 1 ); + nanosleep1( 0, 500000000 /* 500 millis */ ); + } + + FD_LOG_NOTICE(( "RUN: `echo \"%u\" > %s`", (uint)(total_pages+additional_pages_needed), total_page_path )); + write_uint_file( total_page_path, (uint)(total_pages+additional_pages_needed) ); + raised_free_pages = read_uint_file( free_page_path, ERR_MSG ); + if( FD_UNLIKELY( raised_free_pages