Skip to content

Commit

Permalink
[EBPF] gpu: enable periodic uprobe attacher scan (#33630)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjulianm authored Feb 4, 2025
1 parent d4488fa commit 7eafe83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
16 changes: 8 additions & 8 deletions pkg/gpu/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ type Config struct {
ebpf.Config
// Enabled indicates whether the GPU monitoring probe is enabled.
Enabled bool
// ScanTerminatedProcessesInterval is the interval at which the probe scans for terminated processes.
ScanTerminatedProcessesInterval time.Duration
// ScanProcessesInterval is the interval at which the probe scans for new or terminated processes.
ScanProcessesInterval time.Duration
// InitialProcessSync indicates whether the probe should sync the process list on startup.
InitialProcessSync bool
// NVMLLibraryPath is the path of the native libnvidia-ml.so library
Expand All @@ -40,11 +40,11 @@ type Config struct {
func New() *Config {
spCfg := pkgconfigsetup.SystemProbe()
return &Config{
Config: *ebpf.NewConfig(),
ScanTerminatedProcessesInterval: time.Duration(spCfg.GetInt(sysconfig.FullKeyPath(GPUNS, "process_scan_interval_seconds"))) * time.Second,
InitialProcessSync: spCfg.GetBool(sysconfig.FullKeyPath(GPUNS, "initial_process_sync")),
NVMLLibraryPath: spCfg.GetString(sysconfig.FullKeyPath(GPUNS, "nvml_lib_path")),
Enabled: spCfg.GetBool(sysconfig.FullKeyPath(GPUNS, "enabled")),
ConfigureCgroupPerms: spCfg.GetBool(sysconfig.FullKeyPath(GPUNS, "configure_cgroup_perms")),
Config: *ebpf.NewConfig(),
ScanProcessesInterval: time.Duration(spCfg.GetInt(sysconfig.FullKeyPath(GPUNS, "process_scan_interval_seconds"))) * time.Second,
InitialProcessSync: spCfg.GetBool(sysconfig.FullKeyPath(GPUNS, "initial_process_sync")),
NVMLLibraryPath: spCfg.GetString(sysconfig.FullKeyPath(GPUNS, "nvml_lib_path")),
Enabled: spCfg.GetBool(sysconfig.FullKeyPath(GPUNS, "enabled")),
ConfigureCgroupPerms: spCfg.GetBool(sysconfig.FullKeyPath(GPUNS, "configure_cgroup_perms")),
}
}
2 changes: 1 addition & 1 deletion pkg/gpu/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (c *cudaEventConsumer) Start() {
c.wg.Add(1)
go func() {
c.running.Store(true)
processSync := time.NewTicker(c.cfg.ScanTerminatedProcessesInterval)
processSync := time.NewTicker(c.cfg.ScanProcessesInterval)

defer func() {
cleanupExit()
Expand Down
8 changes: 5 additions & 3 deletions pkg/gpu/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,11 @@ func getAttacherConfig(cfg *config.Config) uprobes.AttacherConfig {
},
},
},
EbpfConfig: &cfg.Config,
PerformInitialScan: cfg.InitialProcessSync,
SharedLibsLibset: sharedlibraries.LibsetGPU,
EbpfConfig: &cfg.Config,
PerformInitialScan: cfg.InitialProcessSync,
SharedLibsLibset: sharedlibraries.LibsetGPU,
ScanProcessesInterval: cfg.ScanProcessesInterval,
EnablePeriodicScanNewProcesses: true,
}
}

Expand Down

0 comments on commit 7eafe83

Please sign in to comment.