Subject: Re: kern/31944 - Fix to reduce tmpfs memory usage
To: Julio M. Merino Vidal <jmmv84@gmail.com>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: tech-kern
Date: 04/14/2006 14:13:35
On Fri, 14 Apr 2006 19:51:14 +0200, "Julio M. Merino Vidal"
<jmmv84@gmail.com> wrote:
> Hello,
>
> PR kern/31944 lists three issues that make tmpfs consume too much
> memory. The attached patch addresses the first of them. It does the
> following:
>
> - Only keep the node identifier/generation number when deleting a node.
> The size of tmpfs_nid is much smaller than that of tmpfs_node.
> - Avoid keeping nodes that were initialized but then discarded due to some
> error. See the keepit parameter to the tmpfs_free_node function.
>
> I have read the replies to that PR but the proposed solutions seem to be
> "not right". Also, one question that arises... can there be two live files in a
> file system with the same node number? If not, all those solutions do not
> seem to address this...
>
There's a lot of code that assumes that a <device,inode> pair uniquely
identify files. For example, in src/bin/pax/tables.h, there's this
comment:
/*
* file hard link structure (hashed by dev/ino and chained) used to find the
* hard links in a file system or with some archive formats (cpio)
*/
--Steven M. Bellovin, http://www.cs.columbia.edu/~smb