Re: Hurd Involvement

2014-05-12 Thread Thomas Schwinge
Hi Erick! Posting my answers to your questions to the public bug-hurd@gnu.org mailing list, http://www.gnu.org/software/hurd/mailing_lists/bug-hurd.html, 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

[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. *

[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

[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 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 +++

[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

[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 +++

[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

[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

[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 ---

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 100644

[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

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%. This

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 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 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 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 allowed by

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

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 (ref,

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 of

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 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 references