Date: Tue, 24 Apr 2007 10:47:59 GMT From: Roman Divacky <rdivacky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 118717 for review Message-ID: <200704241047.l3OAlxfG054519@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=118717 Change 118717 by rdivacky@rdivacky_witten on 2007/04/24 10:47:41 Add some comments clarifying what the requeing code does. It took me half a year to understand this ;) Affected files ... .. //depot/projects/linuxolator/src/sys/compat/linux/linux_futex.c#16 edit Differences ... ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_futex.c#16 (text+ko) ==== @@ -401,9 +401,12 @@ TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list); FUTEX_UNLOCK; + /* if we got woken up in futex_wake */ if ((ret == 0) && (wp->wp_new_futex != NULL)) { + /* suspend us on the new futex */ ret = futex_sleep(wp->wp_new_futex, td, timeout); - futex_put(wp->wp_new_futex); /* futex_get called in wakeup */ + /* and release the old one */ + futex_put(wp->wp_new_futex); } free(wp, M_LINUX); @@ -430,10 +433,15 @@ wakeup_one(wp); count++; } else { + /* if we are going to requeue stuff */ if (newf != NULL) { - /* futex_put called after tsleep */ + /* get a new futex */ wp->wp_new_futex = futex_get(newf->f_uaddr, FUTEX_LOCKED); + /* + * and wake it up so the code in futex_sleep + * can requeue us + */ wakeup_one(wp); if (count - n >= n2) break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704241047.l3OAlxfG054519>