Re: [PATCH 03/11] include: add lock-less reference counting primitives

2014-05-12 Thread Samuel Thibault
Justus Winter, le Mon 12 May 2014 12:05:41 +0200, a écrit : > +/* An opaque type. You must not access these values directly. */ > +typedef uint64_t refcounts_t; > + > +/* Instead, the functions manipulating refcounts_t values write the > + results into this kind of objects. */ > +struct refere

Re: [PATCH 02/11] libports: use a single hash table

2014-05-12 Thread Samuel Thibault
Justus Winter, le Mon 12 May 2014 12:05:40 +0200, a écrit : > Previously, libports used a hash table per port bucket. This makes > looking up a port difficult if one does not know the port bucket, as > one has to iterate over all buckets and do a hash table lookup each. But conversely, this makes

Re: [PATCH 10/11] ext2fs: improve {enable,disable}_caching

2014-05-12 Thread Samuel Thibault
Samuel Thibault, le Tue 13 May 2014 00:37:37 +0200, a écrit : > Justus Winter, le Mon 12 May 2014 12:05:48 +0200, a écrit : > > * ext2fs/pager.c (enable_caching, disable_caching): Iterate over the > > pager class instead of over both pager buckets. > > Mmm, did you check the actual implementation

Re: [PATCH 03/11] include: add lock-less reference counting primitives

2014-05-12 Thread Samuel Thibault
Richard Braun, le Tue 13 May 2014 00:36:44 +0200, a écrit : > On Tue, May 13, 2014 at 12:23:48AM +0200, Samuel Thibault wrote: > > Justus Winter, le Mon 12 May 2014 12:05:41 +0200, a écrit : > > > + const union _references op = { .refs = { .hard = 1 } }; > > > + refcounts_t r = __atomic_add_fetch

Re: [PATCH 11/11] fatfs: improve {enable,disable}_caching

2014-05-12 Thread Samuel Thibault
Justus Winter, le Mon 12 May 2014 12:05:49 +0200, a écrit : > * fatfs/pager.c (enable_caching, disable_caching): Iterate over the > pager class instead of over both pager buckets. Ditto. > --- > fatfs/pager.c | 9 + > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/fatf

Re: [PATCH 10/11] ext2fs: improve {enable,disable}_caching

2014-05-12 Thread Samuel Thibault
Justus Winter, le Mon 12 May 2014 12:05:48 +0200, a écrit : > * ext2fs/pager.c (enable_caching, disable_caching): Iterate over the > pager class instead of over both pager buckets. Mmm, did you check the actual implementation of ports_class_iterate? It seems that it just iterates over one bucket,

Re: [PATCH 03/11] include: add lock-less reference counting primitives

2014-05-12 Thread Richard Braun
On Tue, May 13, 2014 at 12:23:48AM +0200, Samuel Thibault wrote: > Justus Winter, le Mon 12 May 2014 12:05:41 +0200, a écrit : > > + const union _references op = { .refs = { .hard = 1 } }; > > + refcounts_t r = __atomic_add_fetch (ref, op.rc, __ATOMIC_RELAXED); > > Mmm, I don't think it is allow

Re: [PATCH 04/11] libports: lock-less reference counting for port_info objects

2014-05-12 Thread Samuel Thibault
Justus Winter, le Mon 12 May 2014 12:05:42 +0200, a écrit : > - pthread_mutex_lock (&_ports_lock); >pthread_mutex_lock (&_ports_htable_lock); > >if (_ports_htable.nr_items == 0) > @@ -60,13 +59,12 @@ _ports_bucket_class_iterate (struct port_bucket *bucket, >if ((bucket == NULL ||

Re: [PATCH 03/11] include: add lock-less reference counting primitives

2014-05-12 Thread Samuel Thibault
Justus Winter, le Mon 12 May 2014 12:05:41 +0200, a écrit : > + const union _references op = { .refs = { .hard = 1 } }; > + refcounts_t r = __atomic_add_fetch (ref, op.rc, __ATOMIC_RELAXED); Mmm, I don't think it is allowed by C to write into a field and read from another field. The legacy Hurd

Re: [PATCH 01/11] ext2fs: cache the superblock

2014-05-12 Thread Samuel Thibault
Justus Winter, le Mon 12 May 2014 12:05:39 +0200, a écrit : > Previously, the superblock was mmaped and a pointer stored in sblock > by map_hypermetadata. This memory is backed by our disk pager. > > This is rather unfortunate, as this means that whenever we read a > value from that location, we

Re: [PATCH 08/11] libihash: reduce the default maximum load factor to 75%

2014-05-12 Thread Samuel Thibault
Justus Winter, le Mon 12 May 2014 12:35:08 +0200, a écrit : > The performance of hash tables depend critically on a low number of > hash collisions. As the table fills up, the chance of collisions > necessarily raises. > > Previously, libihash resized the hash table when the load exceeded > 80%.

[PATCH 08/11] libihash: reduce the default maximum load factor to 75%

2014-05-12 Thread Justus Winter
The performance of hash tables depend critically on a low number of hash collisions. As the table fills up, the chance of collisions necessarily raises. Previously, libihash resized the hash table when the load exceeded 80%. This seems a bit optimistic (e. g. java.util.Hashtable uses 75% as defa

Re: [PATCH 08/11] libihash: reduce the default maximum load factor to 75%

2014-05-12 Thread Samuel Thibault
Well, why? :) Justus Winter, le Mon 12 May 2014 12:05:46 +0200, a écrit : > * libihash/ihash.h (HURD_IHASH_MAX_LOAD_DEFAULT): Set to 75. > --- > libihash/ihash.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libihash/ihash.h b/libihash/ihash.h > index 3ca5ec3..6bdc925

[PATCH 03/11] include: add lock-less reference counting primitives

2014-05-12 Thread Justus Winter
* include/refcount.h: New file. --- include/refcount.h | 174 + 1 file changed, 174 insertions(+) create mode 100644 include/refcount.h diff --git a/include/refcount.h b/include/refcount.h new file mode 100644 index 000..0a9ed8e --- /dev/nu

[PATCH 08/11] libihash: reduce the default maximum load factor to 75%

2014-05-12 Thread Justus Winter
* libihash/ihash.h (HURD_IHASH_MAX_LOAD_DEFAULT): Set to 75. --- libihash/ihash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libihash/ihash.h b/libihash/ihash.h index 3ca5ec3..6bdc925 100644 --- a/libihash/ihash.h +++ b/libihash/ihash.h @@ -94,7 +94,7 @@ typedef struct hur

[PATCH 09/11] libihash: use linear probing and fast modulo operation

2014-05-12 Thread Justus Winter
libihash uses open addressing. Previously, quadratic probing in both directions was used to resolve collisions. Quadratic probing might result in a less efficient use of caches. Also, prime numbers of the form 4 * i + 3 were used as array sizes. This was used in combination with the integer modu

[PATCH 11/11] fatfs: improve {enable,disable}_caching

2014-05-12 Thread Justus Winter
* fatfs/pager.c (enable_caching, disable_caching): Iterate over the pager class instead of over both pager buckets. --- fatfs/pager.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fatfs/pager.c b/fatfs/pager.c index f855ecf..7aa5c5e 100644 --- a/fatfs/pager.c +++ b/f

[PATCH 07/11] libihash: use an integer hash function on the keys

2014-05-12 Thread Justus Winter
Use an integer hash function to derive the index from the key. This should reduce the number of collisions. * libihash/ihash.c (hash_int32): New function. (find_index): Use hash_int32 on the key to derive the index. (add_one): Likewise. --- libihash/ihash.c | 23 +-- 1 file c

[PATCH 10/11] ext2fs: improve {enable,disable}_caching

2014-05-12 Thread Justus Winter
* ext2fs/pager.c (enable_caching, disable_caching): Iterate over the pager class instead of over both pager buckets. --- ext2fs/pager.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ext2fs/pager.c b/ext2fs/pager.c index 017efcc..6328f3b 100644 --- a/ext2fs/pager.c +++ b

[PATCH 02/11] libports: use a single hash table

2014-05-12 Thread Justus Winter
Previously, libports used a hash table per port bucket. This makes looking up a port difficult if one does not know the port bucket, as one has to iterate over all buckets and do a hash table lookup each. Having to iterate over the buckets makes it necessary to keep a list of all buckets, which h

[PATCH 04/11] libports: lock-less reference counting for port_info objects

2014-05-12 Thread Justus Winter
* libports/ports.h (struct port_info): Use the new type. * libports/lookup-port.c: No need to lock _ports_lock anymore. * libports/bucket-iterate.c: Likewise. * libports/complete-deallocate.c: Check if someone reacquired a reference through a hash table lookup. * libports/create-internal.c: Use the

[PATCH 01/11] ext2fs: cache the superblock

2014-05-12 Thread Justus Winter
Previously, the superblock was mmaped and a pointer stored in sblock by map_hypermetadata. This memory is backed by our disk pager. This is rather unfortunate, as this means that whenever we read a value from that location, we might generate a request our disk pager. This amplifies the so-called

[PATCH 06/11] libtrivfs: lock-less reference counting for trivfs_peropen objects

2014-05-12 Thread Justus Winter
* libtrivfs/trivfs.h (struct trivfs_peropen): Use refcount_t for field refcnt. (struct trivfs_control): Remove unused field lock. * libtrivfs/cntl-create.c (trivfs_create_control): Drop the mutex initialization. * libtrivfs/io-reauthenticate.c (trivfs_S_io_reauthenticate): Adjust accordingly. * lib

[PATCH 05/11] libdiskfs: lock-less reference counting for peropen objects

2014-05-12 Thread Justus Winter
* libdiskfs/diskfs.h (struct peropen): Use refcount_t for field refcnt. * libdiskfs/peropen-make.c (diskfs_make_peropen): Initialize refcnt. * libdiskfs/peropen-rele.c (diskfs_release_peropen): Adjust accordingly. * libdiskfs/protid-make.c (diskfs_start_protid): Likewise. Also, the node must no lo

Re: Hurd Involvement

2014-05-12 Thread Thomas Schwinge
Hi Erick! Posting my answers to your questions to the public mailing list, , so that others can join the discussions and/or learn from the answers given. On Wed, 07 May 2014 23:49:19 -0500, Erick Mendoza wrote: > [requirements for in