LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes
@ 2007-01-08 20:46 Jeff Layton
  2007-01-10 20:58 ` Eric Sandeen
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Layton @ 2007-01-08 20:46 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel; +Cc: esandeen, aviro

Resending this set of patches to the list per Al Viro's request. I've gotten
no comments so far, so I'll presume that denotes consent and just ask Andrew
to merge them if I don't hear anything after this ;-).

------[snip]-----

Since Joern mentioned that he thought that hashing the inodes might be simpler
and not have a drastic performance impact, I took the liberty of whipping up
some patches that use that approach. They follow in the next set of emails.

To reiterate, the problems are:

1) on filesystems w/o permanent inode numbers, i_ino values can be
larger than 32 bits, which can cause problems for some 32 bit userspace
programs on a 64 bit kernel. We can't do anything for filesystems that have
actual >32-bit inode numbers, but on filesystems that generate i_ino
values on the fly, we should try to have them fit in 32 bits. We could
trivially fix this by making the static counters in new_inode and iunique
32 bits, but...

2) many filesystems call new_inode and assume that the i_ino values they
are given are unique. They are not guaranteed to be so, since the static
counter can wrap. This problem is exacerbated by the fix for #1.

3) after allocating a new inode, some filesystems call iunique to try to
get a unique i_ino value, but they don't actually add their inodes to
the hashtable, and so they're still not guaranteed to be unique if that
counter wraps.

This patch set takes the simpler approach of simply using iunique and
hashing the inodes afterward. Christoph H. previously mentioned that he
thought that this approach may slow down lookups for filesystems that
currently hash their inodes.

The questions are:

1) how much would this slow down lookups for these filesystems?
2) is it enough to justify adding more infrastructure to avoid it?

What might be best is to start with this approach and then only move to using
IDR or some other scheme if these extra inodes in the hashtable prove to be
problematic.

I've done some cursory testing with this patch and the overhead of hashing
and unhashing the inodes with pipefs is pretty low -- just a few seconds of
system time added on to the creation and destruction of 10 million pipes (very
similar to the overhead that the IDR approach would add).

The hard thing to measure is what effect this has on other filesystems. I'm
open to ways to try and gauge this.

Again, I've only converted pipefs as an example. If this approach is
acceptable then I'll start work on patches to convert other filesystems.

Comments and suggestions welcome...

-- Jeff


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes
  2007-01-08 20:46 [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes Jeff Layton
@ 2007-01-10 20:58 ` Eric Sandeen
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2007-01-10 20:58 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-fsdevel, linux-kernel, esandeen, aviro

Jeff Layton wrote:
> Resending this set of patches to the list per Al Viro's request. I've gotten
> no comments so far, so I'll presume that denotes consent and just ask Andrew
> to merge them if I don't hear anything after this ;-).
> 
> ------[snip]-----
> 
> Since Joern mentioned that he thought that hashing the inodes might be simpler
> and not have a drastic performance impact, I took the liberty of whipping up
> some patches that use that approach. They follow in the next set of emails.
> 
> To reiterate, the problems are:
> 
> 1) on filesystems w/o permanent inode numbers, i_ino values can be
> larger than 32 bits, which can cause problems for some 32 bit userspace
> programs on a 64 bit kernel. We can't do anything for filesystems that have
> actual >32-bit inode numbers, but on filesystems that generate i_ino
> values on the fly, we should try to have them fit in 32 bits. We could
> trivially fix this by making the static counters in new_inode and iunique
> 32 bits, but...
> 
> 2) many filesystems call new_inode and assume that the i_ino values they
> are given are unique. They are not guaranteed to be so, since the static
> counter can wrap. This problem is exacerbated by the fix for #1.
> 
> 3) after allocating a new inode, some filesystems call iunique to try to
> get a unique i_ino value, but they don't actually add their inodes to
> the hashtable, and so they're still not guaranteed to be unique if that
> counter wraps.
> 
> This patch set takes the simpler approach of simply using iunique and
> hashing the inodes afterward. Christoph H. previously mentioned that he
> thought that this approach may slow down lookups for filesystems that
> currently hash their inodes.
> 
> The questions are:
> 
> 1) how much would this slow down lookups for these filesystems?
> 2) is it enough to justify adding more infrastructure to avoid it?
> 
> What might be best is to start with this approach and then only move to using
> IDR or some other scheme if these extra inodes in the hashtable prove to be
> problematic.
> 
> I've done some cursory testing with this patch and the overhead of hashing
> and unhashing the inodes with pipefs is pretty low -- just a few seconds of
> system time added on to the creation and destruction of 10 million pipes (very
> similar to the overhead that the IDR approach would add).
> 
> The hard thing to measure is what effect this has on other filesystems. I'm
> open to ways to try and gauge this.
> 
> Again, I've only converted pipefs as an example. If this approach is
> acceptable then I'll start work on patches to convert other filesystems.
> 
> Comments and suggestions welcome...

The first two seem fine to me; I'm still thinking about how the
un-hashing works in the 3rd one.

Thanks,
-Eric

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes
  2007-01-24 15:21     ` Eric Dumazet
@ 2007-01-24 16:57       ` Jeff Layton
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Layton @ 2007-01-24 16:57 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Andrew Morton, linux-fsdevel, linux-kernel

Eric Dumazet wrote:
 > The problem is you wont see the overhead of insert/delete the inode in a
 > global tree, since you keep hot caches.
 >
 > To have a better estimate of the overhead, I suggest you try to use more
 > active pipes like :
 >

Eric, thanks for the new program. With that, the situation looks slightly
worse:

hashing patch (pipebench):
sys     1m15.329s
sys     1m16.249s
sys     1m17.169s

unpatched (pipebench):
sys     1m9.836s
sys     1m12.541s
sys     1m14.153s

Which works out to 1.05642174294555027017. So ~5-6%.

-- Jeff


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes
  2007-01-24 14:22   ` Jeff Layton
@ 2007-01-24 15:21     ` Eric Dumazet
  2007-01-24 16:57       ` Jeff Layton
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2007-01-24 15:21 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Andrew Morton, linux-fsdevel, linux-kernel

On Wednesday 24 January 2007 15:22, Jeff Layton wrote:
> Andrew Morton wrote:
> > What is the additional overhead, expressed in relative terms?  ie: as a
> > percentage?
>
> Short answer: ~3-4% in a not very scientific test.
>
> Long answer: I timed 3 different runs of a program that created and then
> closed a pipe 10 million times on a patched and unpatched kernel. I then
> added up the "system" times for each and divided them:

Do you mean this program ?

int count, pfd[2];
for (count = 0 ; count < 10000000 ; count++) {
	pipe(pfd);
	close(pfd[0]);
	close(pfd[1]);
}

The problem is you wont see the overhead of insert/delete the inode in a 
global tree, since you keep hot caches.

To have a better estimate of the overhead, I suggest you try to use more 
active pipes like :

#include <unistd.h>
#define SIZE 16384
int fds[SIZE];

int main(int argc, char *argv[])
{
        unsigned int i , count ;

        for (i = 0 ; i < SIZE ; i += 2)
                pipe(fds + i);
        i = 0;
        for (count = 0 ; count < 10000000 ; count++) {
                close(fds[i]);
                close(fds[i + 1]);
                pipe(fds + i);
                i = (i + 2) % SIZE;
        }
        return 0;
}


# ulimit -n 20000
# time ./pipebench

Eric

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes
  2007-01-24  4:46 ` Andrew Morton
@ 2007-01-24 14:22   ` Jeff Layton
  2007-01-24 15:21     ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Layton @ 2007-01-24 14:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fsdevel, linux-kernel

Andrew Morton wrote:
> 
> What is the additional overhead, expressed in relative terms?  ie: as a percentage?

Short answer: ~3-4% in a not very scientific test.

Long answer: I timed 3 different runs of a program that created and then closed 
a pipe 10 million times on a patched and unpatched kernel. I then added up the
"system" times for each and divided them:

unpatched:
sys     1m53.959s
sys     1m56.083s
sys     1m48.055s

patched:
sys     1m56.899s
sys     1m57.027s
sys     1m57.031s

The result was 1.03803642150033866020.

-- Jeff

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes
  2007-01-16 18:57 Jeff Layton
@ 2007-01-24  4:46 ` Andrew Morton
  2007-01-24 14:22   ` Jeff Layton
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2007-01-24  4:46 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-fsdevel, linux-kernel

On Tue, 16 Jan 2007 13:57:38 -0500
Jeff Layton <jlayton@redhat.com> wrote:

> The questions are:
> 
> 1) how much would this slow down lookups for these filesystems?
> 2) is it enough to justify adding more infrastructure to avoid it?
> 
> What might be best is to start with this approach and then only move to using
> IDR or some other scheme if these extra inodes in the hashtable prove to be
> problematic.
> 
> I've done some cursory testing with this patch and the overhead of hashing
> and unhashing the inodes with pipefs is pretty low -- just a few seconds of
> system time added on to the creation and destruction of 10 million pipes (very
> similar to the overhead that the IDR approach would add).

What is the additional overhead, expressed in relative terms?  ie: as a percentage?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes
@ 2007-01-16 18:57 Jeff Layton
  2007-01-24  4:46 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Layton @ 2007-01-16 18:57 UTC (permalink / raw)
  To: akpm; +Cc: linux-fsdevel, linux-kernel

Since there's been no further comment on these patches, I'm going to resend
them one more time and ask Andrew to commit these to -mm. Once they're in
place there, I'll start working on and sending out follow-on patches to
clean up the other filesystems and ensure that they properly hash their
inodes.

------[snip]-----

Since Joern mentioned that he thought that hashing the inodes might be simpler
and not have a drastic performance impact, I took the liberty of whipping up
some patches that use that approach. They follow in the next set of emails.

To reiterate, the problems are:

1) on filesystems w/o permanent inode numbers, i_ino values can be
larger than 32 bits, which can cause problems for some 32 bit userspace
programs on a 64 bit kernel. We can't do anything for filesystems that have
actual >32-bit inode numbers, but on filesystems that generate i_ino
values on the fly, we should try to have them fit in 32 bits. We could
trivially fix this by making the static counters in new_inode and iunique
32 bits, but...

2) many filesystems call new_inode and assume that the i_ino values they
are given are unique. They are not guaranteed to be so, since the static
counter can wrap. This problem is exacerbated by the fix for #1.

3) after allocating a new inode, some filesystems call iunique to try to
get a unique i_ino value, but they don't actually add their inodes to
the hashtable, and so they're still not guaranteed to be unique if that
counter wraps.

This patch set takes the simpler approach of simply using iunique and
hashing the inodes afterward. Christoph H. previously mentioned that he
thought that this approach may slow down lookups for filesystems that
currently hash their inodes.

The questions are:

1) how much would this slow down lookups for these filesystems?
2) is it enough to justify adding more infrastructure to avoid it?

What might be best is to start with this approach and then only move to using
IDR or some other scheme if these extra inodes in the hashtable prove to be
problematic.

I've done some cursory testing with this patch and the overhead of hashing
and unhashing the inodes with pipefs is pretty low -- just a few seconds of
system time added on to the creation and destruction of 10 million pipes (very
similar to the overhead that the IDR approach would add).

The hard thing to measure is what effect this has on other filesystems. I'm
open to ways to try and gauge this.

Again, I've only converted pipefs as an example. If this approach is
acceptable then I'll start work on patches to convert other filesystems.

Comments and suggestions welcome...

-- Jeff


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes
@ 2006-12-29 19:10 Jeff Layton
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Layton @ 2006-12-29 19:10 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel

Since Joern mentioned that he thought that hashing the inodes might be simpler
and not have a drastic performance impact, I took the liberty of whipping up
some patches that use that approach. They follow in the next set of emails.

To reiterate, the problems are:

1) on filesystems w/o permanent inode numbers, i_ino values can be
larger than 32 bits, which can cause problems for some 32 bit userspace
programs on a 64 bit kernel. We can't do anything for filesystems that have
actual >32-bit inode numbers, but on filesystems that generate i_ino
values on the fly, we should try to have them fit in 32 bits. We could
trivially fix this by making the static counters in new_inode and iunique
32 bits, but...

2) many filesystems call new_inode and assume that the i_ino values they
are given are unique. They are not guaranteed to be so, since the static
counter can wrap. This problem is exacerbated by the fix for #1.

3) after allocating a new inode, some filesystems call iunique to try to
get a unique i_ino value, but they don't actually add their inodes to
the hashtable, and so they're still not guaranteed to be unique if that
counter wraps.

This patch set takes the simpler approach of simply using iunique and
hashing the inodes afterward. Christoph H. previously mentioned that he
thought that this approach may slow down lookups for filesystems that
currently hash their inodes.

The questions are:

1) how much would this slow down lookups for these filesystems?
2) is it enough to justify adding more infrastructure to avoid it?

What might be best is to start with this approach and then only move to using
IDR or some other scheme if these extra inodes in the hashtable prove to be
problematic.

I've done some cursory testing with this patch and the overhead of hashing
and unhashing the inodes with pipefs is pretty low -- just a few seconds of
system time added on to the creation and destruction of 10 million pipes (very
similar to the overhead that the IDR approach would add).

The hard thing to measure is what effect this has on other filesystems. I'm
open to ways to try and gauge this.

Again, I've only converted pipefs as an example. If this approach is
acceptable then I'll start work on patches to convert other filesystems.

Comments and suggestions welcome...

-- Jeff


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-01-24 16:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-08 20:46 [PATCH 0/3] i_ino uniqueness: alternate approach -- hash the inodes Jeff Layton
2007-01-10 20:58 ` Eric Sandeen
  -- strict thread matches above, loose matches on Subject: below --
2007-01-16 18:57 Jeff Layton
2007-01-24  4:46 ` Andrew Morton
2007-01-24 14:22   ` Jeff Layton
2007-01-24 15:21     ` Eric Dumazet
2007-01-24 16:57       ` Jeff Layton
2006-12-29 19:10 Jeff Layton

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).