Date: Thu, 3 May 2012 16:27:15 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Attilio Rao <attilio@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, christian.esken@trivago.com Subject: Re: svn commit: r234952 - in head/sys: kern sys Message-ID: <20120503132715.GN2358@deviant.kiev.zoral.com.ua> In-Reply-To: <CAJ-FndCa8xBmKJNnm6kfVpAyCtWtJmoti75XvCBiOR7ppREqng@mail.gmail.com> References: <201205031038.q43Ac2eZ032779@svn.freebsd.org> <CAJ-FndBF7%2BfLwivrMdH=rMHsEVQ5jojk3noceN8wxmaj2ZaTvg@mail.gmail.com> <20120503114913.GJ2358@deviant.kiev.zoral.com.ua> <CAJ-FndCa8xBmKJNnm6kfVpAyCtWtJmoti75XvCBiOR7ppREqng@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--v0lslBALPq2/Zk2u Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 03, 2012 at 02:14:20PM +0100, Attilio Rao wrote: > 2012/5/3, Konstantin Belousov <kostikbel@gmail.com>: > > On Thu, May 03, 2012 at 12:02:08PM +0100, Attilio Rao wrote: > >> 2012/5/3, Konstantin Belousov <kib@freebsd.org>: > >> > Author: kib > >> > Date: Thu May 3 10:38:02 2012 > >> > New Revision: 234952 > >> > URL: http://svn.freebsd.org/changeset/base/234952 > >> > > >> > Log: > >> > When callout_reset_on() cannot immediately migrate a callout since= it > >> > is running on other cpu, the CALLOUT_PENDING flag is temporarily > >> > cleared. Then, callout_stop() on this, in fact active, callout fai= ls > >> > because CALLOUT_PENDING is not set, and callout_stop() returns 0. > >> > > >> > Now, in sleepq_check_timeout(), the failed callout_stop() causes t= he > >> > sleepq code to execute mi_switch() without even setting the wmesg, > >> > since the switch-out is supposed to be transient. In fact, the thr= ead > >> > is put off the CPU for full timeout interval, instead of being put= on > >> > runq immediately. Until timeout fires, the process is unkillable = for > >> > obvious reasons. > >> > > >> > Fix this by marking the migrating callouts with CALLOUT_DFRMIGRATI= ON > >> > flag. The flag is cleared by callout_stop_safe() when the function > >> > detects a migration, besides returning the success. The softclock() > >> > rechecks the flag for migrating callout and cancels its execution = if > >> > the flag was cleared meantime. > >> > >> Can you please clarify why you cannot simply drop the deferred > >> migration in the case !CALLOUT_PENDING in callout_stop_safe()? > > > > I probably can, I think I went with the route of committed patch > > because it is slightly less work. Also, the comment in the while() > > loop suggested me to rely on softclock. >=20 > I don't think this is more work at all, the attached patch > (pre-r234952, untested) should address it properly in few than 10 > lines: > http://www.freebsd.org/~attilio/callout_cancel_mig_stop.patch >=20 > without the need to add further flags and re-using existing mechanisms. (cc->cc_curr !=3D c) is not the case which caused the issue. It might be needed to treatened this way, but the reported case is opposite. --v0lslBALPq2/Zk2u Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk+ih7MACgkQC3+MBN1Mb4gtdACfUK1QNh57ZBpu2xpbPOIiuSEZ 8hEAn1EF1Yy77YYiz+TVmihpyg9JpZNj =uXBb -----END PGP SIGNATURE----- --v0lslBALPq2/Zk2u--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120503132715.GN2358>