MCPcopy
hub / github.com/google/gvisor / getClientFileRangeSettings

Method getClientFileRangeSettings

pkg/sentry/pgalloc/save_restore.go:1987–2011  ·  view source on GitHub ↗
(fileSize uint64)

Source from the content-addressed store, hash-verified

1985}
1986
1987func (f *MemoryFile) getClientFileRangeSettings(fileSize uint64) []stateio.ClientFileRangeSetting {
1988 if !f.opts.AdviseHugepage && !f.opts.AdviseNoHugepage {
1989 return nil
1990 }
1991 var cfrs []stateio.ClientFileRangeSetting
1992 f.forEachChunk(memmap.FileRange{0, fileSize}, func(chunk *chunkInfo, chunkFR memmap.FileRange) bool {
1993 if chunk.huge {
1994 if f.opts.AdviseHugepage {
1995 cfrs = append(cfrs, stateio.ClientFileRangeSetting{
1996 FileRange: chunkFR,
1997 Property: stateio.PropertyHugepage,
1998 })
1999 }
2000 } else {
2001 if f.opts.AdviseNoHugepage {
2002 cfrs = append(cfrs, stateio.ClientFileRangeSetting{
2003 FileRange: chunkFR,
2004 Property: stateio.PropertyNoHugepage,
2005 })
2006 }
2007 }
2008 return true
2009 })
2010 return cfrs
2011}

Callers 2

SaveToMethod · 0.95
LoadFromMethod · 0.95

Calls 1

forEachChunkMethod · 0.95

Tested by

no test coverage detected