From b2991b94e154859d7171607e45891ab75ec26945 Mon Sep 17 00:00:00 2001 From: Ukri Niemimuukko Date: Tue, 8 Sep 2020 18:57:29 +0300 Subject: [PATCH] gpu_plugin: reduce topology scanning for high shared dev count For every created device info, a new topology scan is performed in the filesystem. The shared dev count was implemented so that for each shared device, a new device info was created, which resulted in the topology scan happening as many times per Scan-round, as there were shared devs. This fixes the issue by making the device info to be shared among the shared devices. Signed-off-by: Ukri Niemimuukko --- cmd/gpu_plugin/gpu_plugin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/gpu_plugin/gpu_plugin.go b/cmd/gpu_plugin/gpu_plugin.go index ac98a8a9..1a93dfb3 100644 --- a/cmd/gpu_plugin/gpu_plugin.go +++ b/cmd/gpu_plugin/gpu_plugin.go @@ -148,11 +148,12 @@ func (dp *devicePlugin) scan() (dpapi.DeviceTree, error) { } if len(nodes) > 0 { + deviceInfo := dpapi.NewDeviceInfo(pluginapi.Healthy, nodes, nil, nil) for i := 0; i < dp.sharedDevNum; i++ { devID := fmt.Sprintf("%s-%d", f.Name(), i) // Currently only one device type (i915) is supported. // TODO: check model ID to differentiate device models. - devTree.AddDevice(deviceType, devID, dpapi.NewDeviceInfo(pluginapi.Healthy, nodes, nil, nil)) + devTree.AddDevice(deviceType, devID, deviceInfo) } } }