@@ -157,7 +157,7 @@ func getMemoryLimitV1(chs []cgroupHierarchy, mis []mountInfo) (uint64, error) {
157
157
return 0 , err
158
158
}
159
159
160
- // retrieve the memory limit from the memory.stats and memory.limit_in_bytes files.
160
+ // retrieve the memory limit from the memory.stat and memory.limit_in_bytes files.
161
161
return readMemoryLimitV1FromPath (cgroupPath )
162
162
}
163
163
@@ -173,7 +173,7 @@ func getCgroupV1NoLimit() uint64 {
173
173
func readMemoryLimitV1FromPath (cgroupPath string ) (uint64 , error ) {
174
174
// read hierarchical_memory_limit and memory.limit_in_bytes files.
175
175
// but if hierarchical_memory_limit is not available, then use the max value as a fallback.
176
- hml , err := readHierarchicalMemoryLimit (filepath .Join (cgroupPath , "memory.stats " ))
176
+ hml , err := readHierarchicalMemoryLimit (filepath .Join (cgroupPath , "memory.stat " ))
177
177
if err != nil && ! errors .Is (err , os .ErrNotExist ) {
178
178
return 0 , fmt .Errorf ("failed to read hierarchical_memory_limit: %w" , err )
179
179
} else if hml == 0 {
@@ -202,8 +202,8 @@ func readMemoryLimitV1FromPath(cgroupPath string) (uint64, error) {
202
202
return limit , nil
203
203
}
204
204
205
- // readHierarchicalMemoryLimit extracts hierarchical_memory_limit from memory.stats .
206
- // this function expects the path to be memory.stats file.
205
+ // readHierarchicalMemoryLimit extracts hierarchical_memory_limit from memory.stat .
206
+ // this function expects the path to be memory.stat file.
207
207
func readHierarchicalMemoryLimit (path string ) (uint64 , error ) {
208
208
file , err := os .Open (path )
209
209
if err != nil {
@@ -217,12 +217,12 @@ func readHierarchicalMemoryLimit(path string) (uint64, error) {
217
217
218
218
fields := strings .Split (line , " " )
219
219
if len (fields ) < 2 {
220
- return 0 , fmt .Errorf ("failed to parse memory.stats %q: not enough fields" , line )
220
+ return 0 , fmt .Errorf ("failed to parse memory.stat %q: not enough fields" , line )
221
221
}
222
222
223
223
if fields [0 ] == "hierarchical_memory_limit" {
224
224
if len (fields ) > 2 {
225
- return 0 , fmt .Errorf ("failed to parse memory.stats %q: too many fields for hierarchical_memory_limit" , line )
225
+ return 0 , fmt .Errorf ("failed to parse memory.stat %q: too many fields for hierarchical_memory_limit" , line )
226
226
}
227
227
return strconv .ParseUint (fields [1 ], 10 , 64 )
228
228
}
0 commit comments