Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

If I run top on the guest, the load average values seem to be exactly the same as running top on the host.

Is a Docker (LXC) guest's load average the same as the host's load average?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Looking at the code for /proc/loadavg - yes, it's the same. The load average is read out from global variables.

      seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %ld/%d %d\n",
              LOAD_INT(avnrun[0]), LOAD_FRAC(avnrun[0]),
              LOAD_INT(avnrun[1]), LOAD_FRAC(avnrun[1]),
              LOAD_INT(avnrun[2]), LOAD_FRAC(avnrun[2]),
              nr_running(), nr_threads,
              task_active_pid_ns(current)->last_pid);

http://lxr.free-electrons.com/source/fs/proc/loadavg.c#L13

void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
{
        loads[0] = (avenrun[0] + offset) << shift;
        loads[1] = (avenrun[1] + offset) << shift;
        loads[2] = (avenrun[2] + offset) << shift;
}

http://lxr.free-electrons.com/source/kernel/sched/proc.c#L79

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.