> From: Mike Belopuhov <m...@belopuhov.com> > Date: Wed, 30 Apr 2014 16:00:45 +0200 > > On 30 April 2014 15:55, Mark Kettenis <mark.kette...@xs4all.nl> wrote: > >> Date: Wed, 30 Apr 2014 15:38:39 +0200 (CEST) > >> From: Mark Kettenis <mark.kette...@xs4all.nl> > >> > >> > Date: Wed, 30 Apr 2014 13:39:20 +0100 > >> > From: Stuart Henderson <st...@openbsd.org> > >> > > >> > Seen when running e2fsprogs regression tests with /tmp on tmpfs > >> > >> I'm not surprised; tmpfs contains some serious bugs. I recommend not > >> using it until those are fixed. > > > > Which means, I'd like somebody else besides espie@ to comment on my > > uvm_aobj.c list manipulation hack diff. > > > > Diff made sense to me when I looked at it, but I would rather hide > direct pointer access :/ Perhaps LIST_SWAP does a tiny bit more, > but it's cleaner and perhaps can be useful in the future.
I'm not comfortable with introducing more <sys/queue.h> APIs. So perhaps we should just punt on the optimization and remove/insert all list items. Removing the trap comments that pedro set up... Index: uvm_aobj.c =================================================================== RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v retrieving revision 1.61 diff -u -p -r1.61 uvm_aobj.c --- uvm_aobj.c 13 Apr 2014 23:14:15 -0000 1.61 +++ uvm_aobj.c 30 Apr 2014 14:52:33 -0000 @@ -431,6 +431,7 @@ uao_shrink_hash(struct uvm_object *uobj, { struct uvm_aobj *aobj = (struct uvm_aobj *)uobj; struct uao_swhash *new_swhash; + struct uao_swhash_elt *elt; unsigned long new_hashmask; int i; @@ -456,8 +457,13 @@ uao_shrink_hash(struct uvm_object *uobj, * Even though the hash table size is changing, the hash of the buckets * we are interested in copying should not change. */ - for (i = 0; i < UAO_SWHASH_BUCKETS(aobj->u_pages); i++) - LIST_FIRST(&new_swhash[i]) = LIST_FIRST(&aobj->u_swhash[i]); + for (i = 0; i < UAO_SWHASH_BUCKETS(aobj->u_pages); i++) { + while (LIST_EMPTY(&aobj->u_swhash[i]) == 0) { + elt = LIST_FIRST(&aobj->u_swhash[i]); + LIST_REMOVE(elt, list); + LIST_INSERT_HEAD(&new_swhash[i], elt, list); + } + } free(aobj->u_swhash, M_UVMAOBJ); @@ -609,7 +615,6 @@ uao_grow_hash(struct uvm_object *uobj, i return ENOMEM; for (i = 0; i < UAO_SWHASH_BUCKETS(aobj->u_pages); i++) { - /* XXX pedro: shouldn't copying the list pointers be enough? */ while (LIST_EMPTY(&aobj->u_swhash[i]) == 0) { elt = LIST_FIRST(&aobj->u_swhash[i]); LIST_REMOVE(elt, list);