Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2007 14:29:43 +0100
From:      "Attilio Rao" <attilio@freebsd.org>
To:        "Jeff Roberson" <jroberson@chesapeake.net>
Cc:        cvs-src@freebsd.org, Jeff Roberson <jeff@freebsd.org>, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/conf options src/sys/kern kern_mutex.c kern_rwlock.c kern_sx.c kern_thread.c sched_4bsd.c sched_ule.c subr_lock.c src/sys/sys _lock.h lock_profile.h proc.h sx.h
Message-ID:  <3bbf2fe10712170529h4a383d0eodf460203fa52aba3@mail.gmail.com>
In-Reply-To: <20071215132041.D922@desktop>
References:  <200712152313.lBFNDWWR060641@repoman.freebsd.org> <20071215132041.D922@desktop>

next in thread | previous in thread | raw e-mail | index | archive | help
2007/12/16, Jeff Roberson <jroberson@chesapeake.net>:
> On Sat, 15 Dec 2007, Jeff Roberson wrote:
>
> > jeff        2007-12-15 23:13:32 UTC
> >
> >  FreeBSD src repository
> >
> >  Modified files:
> >    sys/conf             options
> >    sys/kern             kern_mutex.c kern_rwlock.c kern_sx.c
> >                         kern_thread.c sched_4bsd.c sched_ule.c
> >                         subr_lock.c
> >    sys/sys              _lock.h lock_profile.h proc.h sx.h
>
> Some of you may complain about the inclusion of lock_profile.h in
> sys/proc.h.  I hope you will forgive this since lock profiling now no
> longer disturbs the ABI and will work with binary modules as well.

Hello,

+void
+lock_profile_obtain_lock_success(struct lock_object *lo, int contested,
+    uint64_t waittime, const char *file, int line)
+{
+	static int lock_prof_count;
+	struct lock_profile_object *l;
+	int spin;
+
+	/* don't reset the timer when/if recursing */
+	if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE))
+		return;
+	if (lock_prof_skipcount &&
+	    (++lock_prof_count % lock_prof_skipcount) == 0)
+		return;
+	spin = LOCK_CLASS(lo) == &lock_class_mtx_spin;
+	if (spin && lock_prof_skipspin == 1)
+		return;

I would really like to get ride of this kind of checks against
lock_class_* objects.
The correct thing to do here is to check for the LC_SPINLOCK in the
class flags (this is exactly why they have been introduced I think).

I have a question though.
Does this new implementation track adaptive spinning in locks?
I would have expected a different function for something like that as
"lock_profile_obtain_lock_spinning()" or similar in order to track
both spinning and sleeping times about the same locks, but looking at
function prototypes, at consumers and looking at members of struct
lock_prof I don't see any obvious evidence of it.

Thanks for this work, I really like that our ABI is no longer broken :)

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?3bbf2fe10712170529h4a383d0eodf460203fa52aba3>