[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mounting tmpfs (and sysfs) defaultly in sarge?



At Sat, 13 Dec 2003 11:42:45 +0000,
Roger Leigh wrote:
> > Tmpfs in Linux kernel 2.4, is formally known as shmfs (posix shared
> > memory filesystem).  It's useful for memory-based filesystem like
> > Solaris tmpfs.  However, if we support new Posix IPC like shm_open(3),
> > shm_unlink(3), to make debian posix compliant (and like other
> > distros), it should be mounted on /dev/shm.  In the past there were
> > some discussed, ex:
> >
> > 	http://lists.debian.org/debian-devel/2001/debian-devel-200111/msg00706.html
> >
> > So I propose:
> >
> >   - /dev/MAKEDEV should have /dev/shm in "std" entry.
> >   - /etc/fstab should mount /dev/shm (tmpfs) in default.
> 
> Please make sure that when this is added, you do default to a sensible
> size option.  For example:
> 
> none    /dev/shm    tmpfs    defaults,size=500M    0    0

AFAIK, it's no problem.  If we mount tmpfs without size= option,
kernel automatically limits a half of real memory size.  In addition,
memory contents in tmpfs can swap out from memory to HDD.  This is one
of nice feature of tmpfs.  If we would like to avoid this size issue,
then we only specify size=1M (or 10M) for posix IPC.

If user specify size option in fstab explicitly, then it's user's
fault.  /dev/shm is used for posix IPC, not ram based temporary
filesystem.  If user wants to mount tmpfs for his temporary work, then
/dev/shm is not suitable place.

> If you don't specify a default limit, any user can kill the system by
> creating a huge file in there.  It's much nicer to get ENOSPC than a
> kernel panic.  The installer could pick a sensible limit based on, for
> example, 20% of the combined core+swap size.

If system memory is exhausted, then (1) swap (2) OOM Killer (3)
ENOSPC.  If we see kernel panic, then it's kernel bug.

Regards,
-- gotom



Reply to: