mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-15 14:53:44 +00:00
fix kubelet crash, concurrent map iteration and map write
When kubelet starts a Pod that requires device resources, if the device plug-in updates the device at the same time, it may cause kubelet to crash. Signed-off-by: huyinhou <huyinhou@bytedance.com>
This commit is contained in:
parent
789dc88fd5
commit
692f8aab27
@ -147,11 +147,15 @@ func (m *ManagerImpl) deviceHasTopologyAlignment(resource string) bool {
|
||||
}
|
||||
|
||||
func (m *ManagerImpl) getAvailableDevices(resource string) sets.String {
|
||||
m.mutex.Lock()
|
||||
defer m.mutex.Unlock()
|
||||
// Strip all devices in use from the list of healthy ones.
|
||||
return m.healthyDevices[resource].Difference(m.allocatedDevices[resource])
|
||||
}
|
||||
|
||||
func (m *ManagerImpl) generateDeviceTopologyHints(resource string, available sets.String, reusable sets.String, request int) []topologymanager.TopologyHint {
|
||||
m.mutex.Lock()
|
||||
defer m.mutex.Unlock()
|
||||
// Initialize minAffinitySize to include all NUMA Nodes
|
||||
minAffinitySize := len(m.numaNodes)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user