On Wed, Jul 14, 2021 at 10:30:22PM +0800, yong w wrote: > Thanks for your reply! > > > Limit max size of ramfs. > It's no use using size to limit the size of ramfs. > "mount -t ramfs -o size=10M ramfs /ramfs" is the command i use. > ramfs does not support size= limiting, that's what tmpfs is for. > > > > The comments already explains why kernel should panic on this situation: > > /* > > * If we got here due to an actual allocation at the > > * system level, we cannot survive this and will enter > > * an endless loop in the allocator. Bail out now. > > */ > > But it causes panic, actually , I don't want it panics Then use tmpfs and specify size=. It's mentioned in filesystems/tmpfs.rst --8<-- If you compare it to ramfs (which was the template to create tmpfs) you gain swapping and limit checking. Another similar thing is the RAM disk (/dev/ram*), which simulates a fixed size hard disk in physical RAM, where you have to create an ordinary filesystem on top. Ramdisks cannot swap and you do not have the possibility to resize them. --8<-- -- Mel Gorman SUSE Labs