Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 May 2012 12:02:08 +0100
From:      Attilio Rao <attilio@freebsd.org>
To:        Konstantin Belousov <kib@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r234952 - in head/sys: kern sys
Message-ID:  <CAJ-FndBF7%2BfLwivrMdH=rMHsEVQ5jojk3noceN8wxmaj2ZaTvg@mail.gmail.com>
In-Reply-To: <201205031038.q43Ac2eZ032779@svn.freebsd.org>
References:  <201205031038.q43Ac2eZ032779@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 fails
>   because CALLOUT_PENDING is not set, and callout_stop() returns 0.
>
>   Now, in sleepq_check_timeout(), the failed callout_stop() causes the
>   sleepq code to execute mi_switch() without even setting the wmesg,
>   since the switch-out is supposed to be transient. In fact, the thread
>   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_DFRMIGRATION
>   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()?

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-FndBF7%2BfLwivrMdH=rMHsEVQ5jojk3noceN8wxmaj2ZaTvg>