Date: Tue, 25 Apr 2006 18:33:02 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96081 for review Message-ID: <200604251833.k3PIX2fD084660@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96081 Change 96081 by jhb@jhb_slimer on 2006/04/25 18:32:24 Bring in up/downgrade tests from jhb_lock. Affected files ... .. //depot/projects/smpng/sys/modules/crash2/crash2.c#9 integrate Differences ... ==== //depot/projects/smpng/sys/modules/crash2/crash2.c#9 (text+ko) ==== @@ -97,6 +97,59 @@ /* Events. */ static void +foo_grades(void) +{ + + switch (arc4random() % 10) { + case 0: + rw_wlock(&foo); + DELAY(30); + rw_wunlock(&foo); + break; + case 1: + case 2: + rw_rlock(&foo); + DELAY(40); + if (!rw_try_upgrade(&foo)) { + rw_runlock(&foo); + rw_wlock(&foo); + DELAY(40); + } + DELAY(10); + rw_wunlock(&foo); + break; + case 3: + case 4: + case 5: + case 6: + rw_wlock(&foo); + DELAY(30); + rw_downgrade(&foo); + DELAY(20); + rw_runlock(&foo); + break; + default: + rw_rlock(&foo); + DELAY(50); + rw_runlock(&foo); + } +} + +static void +foo_grades_lots(void) +{ + int i; + + for (i = 0; i < 50000; i++) + foo_grades(); +} + +CRASH2_EVENT("lots of foo up/downgrades", foo_grades_lots, foo_grades_lots, + foo_grades_lots, foo_grades_lots); +CRASH2_EVENT("foo up/downgrades", foo_grades, foo_grades, foo_grades, + foo_grades); + +static void bar_sleep(void) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604251833.k3PIX2fD084660>