size limit for TMPFS

Eric Anderson anderson at freebsd.org
Thu May 17 11:34:01 UTC 2007


On 05/17/07 04:36, Howard Su wrote:
> In current implementation of tmpfs, the size limit of a tmpfs (which
> is passed when mounting) only count the file size. The memory used for
> directories is not limit. This due to the fact that there is not easy
> and fast way to track a uma_zone's memory usage.
> 
> there are several approach:
> 1. hack vm to support a hook when uma_zone allocate a new page. this
> approach comes from Rohit Jalan. This also need some new API in uma(9)
> uma_set_allocate_hook
> uma_set_deallocate_hook
> 
> 
> 2. Add a new API to uma(9) to report its memory usage. This will
> require traveling a link list inside uma_zone.
> uma_get_paged
> 
> 3. Guess a file number limit based on size if use doesn't specific
> explict, or get the number user sepcified. Use the number limit
> instead of size limit to limit the memory usage. This doesn't need any
> changes to uma. Also the implementation is clean.
> 
> I personally perfer way 3. Any suggestions?
> 


Track the memory usage on your own?  As you allocate, keep a counter and 
total up the usage outside of uma.  (3) sounds good, except it may not 
be accurate, and that could lead to confusion for someone.


Eric



More information about the freebsd-fs mailing list