@@ -345,6 +345,7 @@ impl NamespacedOrchestrator for NamespacedProcessOrchestrator {
345345 cpu_limit : config. cpu_limit ,
346346 scale : config. scale ,
347347 labels : config. labels ,
348+ enable_transparent_hugepages : config. enable_transparent_hugepages ,
348349 disk,
349350 } ;
350351
@@ -461,6 +462,8 @@ struct EnsureServiceConfig {
461462 pub labels : BTreeMap < String , String > ,
462463 /// Whether scratch disk space should be allocated for the service.
463464 pub disk : bool ,
465+ /// Whether to enable transparent hugepages.
466+ pub enable_transparent_hugepages : bool ,
464467}
465468
466469/// A task executing blocking work for a [`NamespacedProcessOrchestrator`] in the background.
@@ -572,6 +575,7 @@ impl OrchestratorWorker {
572575 scale,
573576 labels,
574577 disk,
578+ enable_transparent_hugepages,
575579 } : EnsureServiceConfig ,
576580 ) -> Result < ( ) , anyhow:: Error > {
577581 let full_id = self . config . full_id ( & id) ;
@@ -686,6 +690,7 @@ impl OrchestratorWorker {
686690 memory_limit,
687691 cpu_limit,
688692 launch_spec : self . config . launch_spec ,
693+ enable_transparent_hugepages,
689694 } ) ,
690695 ) ;
691696
@@ -791,6 +796,7 @@ impl OrchestratorWorker {
791796 memory_limit,
792797 cpu_limit,
793798 launch_spec,
799+ enable_transparent_hugepages,
794800 } : ServiceProcessConfig ,
795801 ) -> impl Future < Output = ( ) > + use<> {
796802 let suppress_output = self . config . suppress_output ;
@@ -838,6 +844,9 @@ impl OrchestratorWorker {
838844 memory_limit. as_ref ( ) ,
839845 cpu_limit. as_ref ( ) ,
840846 ) ;
847+ if enable_transparent_hugepages {
848+ cmd. env ( "MALLOC_CONF" , "thp:always" ) ;
849+ }
841850 info ! (
842851 "launching {full_id}-{i} via {} {}..." ,
843852 cmd. as_std( ) . get_program( ) . to_string_lossy( ) ,
@@ -933,6 +942,7 @@ struct ServiceProcessConfig {
933942 memory_limit : Option < MemoryLimit > ,
934943 cpu_limit : Option < CpuLimit > ,
935944 launch_spec : LaunchSpec ,
945+ enable_transparent_hugepages : bool ,
936946}
937947
938948struct ServiceProcessPort {
0 commit comments