@@ -297,7 +297,7 @@ func New(conf *config.Config, args Args) (*Container, error) {
297297 if err := nvProxyPreGoferHostSetup (args .Spec , conf ); err != nil {
298298 return nil , err
299299 }
300- if err := runInCgroup (containerCgroup , func () error {
300+ if err := cgroup . RunInCgroup (containerCgroup , func () error {
301301 ioFiles , goferFilestores , devIOFile , specFile , err := c .createGoferProcess (conf , mountHints , args .Attached )
302302 if err != nil {
303303 return fmt .Errorf ("cannot create gofer process: %w" , err )
@@ -451,7 +451,7 @@ func (c *Container) startImpl(conf *config.Config, action string, startRoot func
451451 } else {
452452 // Join cgroup to start gofer process to ensure it's part of the cgroup from
453453 // the start (and all their children processes).
454- if err := runInCgroup (c .Sandbox .CgroupJSON .Cgroup , func () error {
454+ if err := cgroup . RunInCgroup (c .Sandbox .CgroupJSON .Cgroup , func () error {
455455 // Create the gofer process.
456456 goferFiles , goferFilestores , devIOFile , mountsFile , err := c .createGoferProcess (conf , c .Sandbox .MountHints , false /* attached */ )
457457 if err != nil {
@@ -1589,20 +1589,6 @@ func isRoot(spec *specs.Spec) bool {
15891589 return specutils .SpecContainerType (spec ) != specutils .ContainerTypeContainer
15901590}
15911591
1592- // runInCgroup executes fn inside the specified cgroup. If cg is nil, execute
1593- // it in the current context.
1594- func runInCgroup (cg cgroup.Cgroup , fn func () error ) error {
1595- if cg == nil {
1596- return fn ()
1597- }
1598- restore , err := cg .Join ()
1599- if err != nil {
1600- return err
1601- }
1602- defer restore ()
1603- return fn ()
1604- }
1605-
16061592// adjustGoferOOMScoreAdj sets the oom_store_adj for the container's gofer.
16071593func (c * Container ) adjustGoferOOMScoreAdj () error {
16081594 goferPid := c .GoferPid .Load ()
0 commit comments