Date: Mon, 3 Aug 2009 09:26:10 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-current@freebsd.org Subject: Patch to address coredump slowdown Message-ID: <200908030926.12472.hselasky@c2i.net>
next in thread | raw e-mail | index | archive | help
--Boundary-00=_UEpdKHFUUlIBNl5 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, The following attached patch addresses recently slowed coredumps. http://perforce.freebsd.org/chv.cgi?CH=166957 MD5 (ukbd.c.diff) = 1e3c143942593b0ed4617d306a9d2ee2 cd /usr/src/sys/dev/usb/input/ cat ukbd.c.diff | patch --HPS --Boundary-00=_UEpdKHFUUlIBNl5 Content-Type: text/x-patch; charset="iso-8859-1"; name="ukbd.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ukbd.c.diff" --- ukbd.c 2009-08-02 16:28:40.000000000 +0200 +++ ukbd.c 2009-08-03 09:12:42.000000000 +0200 @@ -170,6 +170,7 @@ int32_t sc_state; /* shift/lock key state */ int32_t sc_accents; /* accent key index (> 0) */ + uint16_t sc_microtime; /* used when polling */ uint16_t sc_inputs; uint16_t sc_inputhead; uint16_t sc_inputtail; @@ -302,18 +303,32 @@ static void ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait) { + struct timeval tv; + uint16_t temp; + DPRINTFN(2, "polling\n"); while (sc->sc_inputs == 0) { usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER); - DELAY(1000); /* delay 1 ms */ + microtime(&tv); - sc->sc_time_ms++; + temp = tv.tv_usec / 25000; /* support repetition of keys: */ + if (sc->sc_microtime != temp) { + + /* wait for next delta */ + + sc->sc_microtime = temp; + + /* 25 milliseconds have passed */ + + sc->sc_time_ms += 25; + } + ukbd_interrupt(sc); if (!wait) --Boundary-00=_UEpdKHFUUlIBNl5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908030926.12472.hselasky>