Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Oct 2011 00:22:52 +0200
From:      Attilio Rao <attilio@freebsd.org>
To:        Haozhong Zhang <snowzh8512@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: question about the exchanges of td->td_lock and mtx in sched_switch() of sched_ule
Message-ID:  <CAJ-FndCvsNTTaWMQZd=MH1dYP0xqu=7T7dfgsPbW8QdHkp8=fA@mail.gmail.com>
In-Reply-To: <CAK6mpvpzg_8=kRvCPuH0%2Bn%2BFbfwzJUEtRVSjVi-DSNe%2BLaW46Q@mail.gmail.com>
References:  <CAK6mpvpzg_8=kRvCPuH0%2Bn%2BFbfwzJUEtRVSjVi-DSNe%2BLaW46Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/10/13 Haozhong Zhang <snowzh8512@gmail.com>:
> Hi,
>
> I'm recently reading the code of sched_ule in freebsd 8.2.0 and have two
> questions.
>
> 1. sched_switch() (in sched_ule.c) invokes cpu_switch() (at line 1852) and
> thread_unblock_switch() (at line 1867). These two functions exchange
> td->td_lock and mtx. What are the purposes of these exchanges?
>
> 2. Can the exchange in cpu_switch() (in amd64/amd64/cpu_switch.S, at line
> 134) be done before calling cpu_switch()? I mean, does this reorder of
> exchange and other operations in cpu_switch() cause side-effects to other
> code?

This thread should have the details you need:
http://lists.freebsd.org/pipermail/svn-src-all/2010-January/019345.html

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-FndCvsNTTaWMQZd=MH1dYP0xqu=7T7dfgsPbW8QdHkp8=fA>