Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Jun 2016 11:28:42 +0300
From:      =?UTF-8?B?QnVsYXQgQnVsYXQ=?= <bltsrc@mail.ru>
To:        =?UTF-8?B?ZnJlZWJzZC1oYWNrZXJz?= <freebsd-hackers@freebsd.org>
Subject:   =?UTF-8?B?VHVybnN0aWxlX3B1cnBvc2VvZl90c19mcmVl?=
Message-ID:  <1465115322.11439513@f431.i.mail.ru>

next in thread | raw e-mail | index | archive | help


Hi, guys.

Have little question about implementation of turnstiles in the kernel.
That is, what is the purpose of ts_free list in turnstile structure? 
Related file: kern/subr_turnstile.c

I understand that turnstile is used for tracking non-sleepable locks, tracking
blocked threads on that lock, that
when thread blocks on lock it adds its own turnstile to lock's turnstile's ts_free
list and regrabs any available turnstile from that lock's turnstile's ts_free list when
it is waking up.

Could you please explain, why algorithm does so, why goes through  hassle of
putting turnstile into ts_free only to regrab it from ts_free later, as it stores pointer to own turnstile
and could keep it there, using only when it is the first thread to be blocked on a lock.

There is definitely logic in using ts_free member, but it is a bit unclear for me.
Would be glad to see your explanation, thanks.

bnm


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1465115322.11439513>