Quoting 魏子然 ([email protected]):
> Hello, we encounter a problem in the use of lxc, that the command of free
> and top does
> not show container\'s cpu and memory but the host server\'s;we know that it
> is a problem
> of proc directory which is mounted outside the container with remount
> option.we also
Being mounted outside the container isn't the problem. The problem,
depending on who you ask, is that the tools want /proc to be something
it isn't. The ideal, according to kernel community, would be for
someone to write a new library which can integrate the /proc and
cgroup information to give the desired information to userspace
tools like top and free - not to keep trying to paper over /proc.
That said, after many years noone has sat down and volunteered their
time to actually write such a library and propose patches to the
rest of upstream (top etc) to use those - so papering over /proc
still is appealing :)
> know that we can solve this problem with fuse.
>
> now we put forward another solution which is also based on fuse,but with more
> difference,our solution is modify lxc-start.c:
> before do_clone() we use fuse to generate a userspaces proc filesystem,call
> mount() to
> mount /lxc/as6.3/proc directory;
> after perform mount_rootfs_dir ($rootfs, $target) ,then call mount() to mount
> /lxc/as6.3/proc/{stat, meminfo, sysrq-trigger} to target/{stat, meminfo,
> sysrq-trigger} with --
> bind option.
>
> When a virtual machine to read /proc/meminfo, it will read the meminfo of
> from
> userspaces filesystem, we can get the correct value is returned to the
> virtual machine
> from /cgroup/memory.if read /proc/stat, we can get value form /cgroup/cpuacct.
>
> All mount implemented in lxc_start.c using c language, userspace files can be
> configured in the configuration file and dynamic loading.
>
> The function of open and read and write of meminfo,stat,sysrq-trigger must be
> implemented by us.
>
>
> this is a example,in configuration file:
> lxc.cgroup.memory.limit_in_bytes = 268435456
> lxc.cgroup.memory.memsw.limit_in_bytes = 536870912
>
> [shell]#free -m
> total used free shared buffers cached
> Mem: 256 13 242 0 0 0
> -/+ buffers/cache: 13 242
> Swap: 512 13 498
Do you have a patch somewhere?
-serge
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Lxc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-devel