On 02/21/2011 10:42 AM, Daniel Farina wrote: > On Mon, Feb 21, 2011 at 1:33 AM, Daniel Lezcano<[email protected]> > wrote: >> On 02/20/2011 08:08 PM, Daniel Farina wrote: >>> Hello list, >>> >>> I've been scouring The Internet on and off for this, but have not come >>> to a conclusion: >>> >>> Does a linux host running LXC share code maps between containers? e.g. >>> redundant read-only maps to the same .so or /bin/foo, as defined by an >>> equivalent hardlink? >> Hmm, I suppose you are refering to similar feature than >> http://linux-vserver.org/util-vserver:Vhashify right ? > I think my need/question is simpler than that: basically, when running > a binary, I am asking if there is a way to arrange sharing of the > read-only code-segment/binary maps between processes, as they usually > do when using non-lxc process isolation. > > Ex: if I have 1000 containers running, and all use libc, I'd want to > not spend a megabyte per libc (as seen in /proc/<pid>/smaps) per > container. I want to spend one megabyte for code space among all 1000 > containers.
Yep, as Serge mentioned, you can read-only bind mount in your container's rootfs the system binary/library directories. eg. ... lxc.rootfs = $rootfs lxc.mount.entry=/lib $rootfs/lib none ro,bind 0 0 lxc.mount.entry=/bin $rootfs/bin none ro,bind 0 0 lxc.mount.entry=/usr /$rootfs/usr none ro,bind 0 0 lxc.mount.entry=/sbin $rootfs/sbin none ro,bind 0 0 ... There is no variable substitution here, it is an example. You should replace $rootfs by an absolute path. Cheers -- Daniel ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Lxc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lxc-users
