linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: "zhengbin (A)" <zhengbin13@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	viro@zeniv.linux.org.uk, hughd@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, houtao1@huawei.com,
	yi.zhang@huawei.com, "J. R. Okajima" <hooanon05g@gmail.com>
Subject: Re: [PATCH] tmpfs: use ida to get inode number
Date: Wed, 20 Nov 2019 20:52:36 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.11.1911202026040.1825@eggly.anvils> (raw)
In-Reply-To: <1c64e7c2-6460-49cf-6db0-ec5f5f7e09c4@huawei.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3101 bytes --]

On Thu, 21 Nov 2019, zhengbin (A) wrote:
> On 2019/11/20 23:45, Matthew Wilcox wrote:
> > On Wed, Nov 20, 2019 at 10:23:18PM +0800, zhengbin wrote:
> >> I have tried to change last_ino type to unsigned long, while this was
> >> rejected, see details on https://patchwork.kernel.org/patch/11023915.
> > Did you end up trying sbitmap?
> 
> Maybe sbitmap is not a good solution, max_inodes of tmpfs are controlled by mount options--nrinodes,
> 
> which can be modified by remountfs(bigger or smaller), as the comment of function sbitmap_resize says:
> 
>  * Doesn't reallocate anything. It's up to the caller to ensure that the new
>  * depth doesn't exceed the depth that the sb was initialized with.
> 
> We can modify this to meet the growing requirements, there will still be questions as follows:
> 
> 1. tmpfs is a ram filesystem, we need to allocate sbitmap memory for sbinfo->max_inodes(while this maybe huge)
> 
> 2.If remountfs changes  max_inode, we have to deal with it, while this may take a long time
> 
> (bigger: we need to free the old sbitmap memory, allocate new memory, copy the old sbitmap to new sbitmap
> 
> smaller: How do we deal with it?ie: we use sb->map[inode number/8] to find the sbitmap, we need to change the exist
> 
> inode numbers?while this maybe used by userspace application.)
> 
> >
> > What I think is fundamentally wrong with this patch is that you've found a
> > problem in get_next_ino() and decided to use a different scheme for this
> > one filesystem, leaving every other filesystem which uses get_next_ino()
> > facing the same problem.
> >
> > That could be acceptable if you explained why tmpfs is fundamentally
> > different from all the other filesystems that use get_next_ino(), but
> > you haven't (and I don't think there is such a difference.  eg pipes,
> > autofs and ipc mqueue could all have the same problem.
> 
> tmpfs is same with all the other filesystems that use get_next_ino(), but we need to solve this problem one by one.
> 
> If tmpfs is ok, we can modify the other filesystems too. Besides, I do not  recommend all file systems share the same
> 
> global variable, for performance impact consideration.
> 
> >
> > There are some other problems I noticed, but they're not worth bringing
> > up until this fundamental design choice is justified.
> Agree, thanks.

Just a rushed FYI without looking at your patch or comments.

Internally (in Google) we do rely on good tmpfs inode numbers more
than on those of other get_next_ino() filesystems, and carry a patch
to mm/shmem.c for it to use 64-bit inode numbers (and separate inode
number space for each superblock) - essentially,

	ino = sbinfo->next_ino++;
	/* Avoid 0 in the low 32 bits: might appear deleted */
	if (unlikely((unsigned int)ino == 0))
		ino = sbinfo->next_ino++;

Which I think would be faster, and need less memory, than IDA.
But whether that is of general interest, or of interest to you,
depends upon how prevalent 32-bit executables built without
__FILE_OFFSET_BITS=64 still are these days.

Hugh

  reply	other threads:[~2019-11-21  4:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 14:23 [PATCH] tmpfs: use ida to get inode number zhengbin
2019-11-20 15:45 ` Matthew Wilcox
2019-11-21  2:36   ` zhengbin (A)
2019-11-21  4:52     ` Hugh Dickins [this message]
2019-11-21  6:45       ` zhengbin (A)
2019-11-21 19:53         ` Hugh Dickins
2019-11-22  1:23           ` zhengbin (A)
2019-11-22 22:13             ` Matthew Wilcox
2019-11-23  2:16               ` zhengbin (A)
2019-11-23  2:33                 ` Matthew Wilcox
2019-11-23  4:54                   ` Al Viro
2019-12-01  8:44               ` zhengbin (A)
2019-11-21 11:40       ` J. R. Okajima
2019-11-21 20:07         ` Hugh Dickins
2019-11-21  4:31   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.11.1911202026040.1825@eggly.anvils \
    --to=hughd@google.com \
    --cc=hooanon05g@gmail.com \
    --cc=houtao1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=yi.zhang@huawei.com \
    --cc=zhengbin13@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).