diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index c72ed4c5a..826e34480 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -706,8 +706,8 @@ func (tr *TaskRunner) buildTaskConfig() *drivers.TaskConfig { Resources: &drivers.Resources{ NomadResources: taskResources, LinuxResources: &drivers.LinuxResources{ - MemoryLimitBytes: int64(taskResources.Memory.MemoryMB) * 1024 * 1024, - CPUShares: int64(taskResources.Cpu.CpuShares), + MemoryLimitBytes: taskResources.Memory.MemoryMB * 1024 * 1024, + CPUShares: taskResources.Cpu.CpuShares, PercentTicks: float64(taskResources.Cpu.CpuShares) / float64(tr.clientConfig.Node.NodeResources.Cpu.CpuShares), }, }, diff --git a/drivers/shared/executor/executor_linux.go b/drivers/shared/executor/executor_linux.go index 83f405f8e..9a06e1140 100644 --- a/drivers/shared/executor/executor_linux.go +++ b/drivers/shared/executor/executor_linux.go @@ -580,7 +580,7 @@ func configureCgroups(cfg *lconfigs.Config, command *ExecCommand) error { if mb := command.Resources.NomadResources.Memory.MemoryMB; mb > 0 { // Total amount of memory allowed to consume - cfg.Cgroups.Resources.Memory = int64(mb * 1024 * 1024) + cfg.Cgroups.Resources.Memory = mb * 1024 * 1024 // Disable swap to avoid issues on the machine var memSwappiness uint64 cfg.Cgroups.Resources.MemorySwappiness = &memSwappiness