Commit Graph

44 Commits

Author SHA1 Message Date
Christian Brueffer
1e9469d188 Fix various mdoc issues and some EOL whitespace.
Found with:	mandoc -Tlint
2014-12-21 10:57:42 +00:00
Konstantin Belousov
72ba3c0822 Fix two issues with lockmgr(9) LK_CAN_SHARE() test, which determines
whether the shared request for already shared-locked lock could be
granted.  Both problems result in the exclusive locker starvation.

The concurrent exclusive request is indicated by either
LK_EXCLUSIVE_WAITERS or LK_EXCLUSIVE_SPINNERS flags.  The reverse
condition, i.e. no exclusive waiters, must check that both flags are
cleared.

Add a flag LK_NODDLKTREAT for shared lock request to indicate that
current thread guarantees that it does not own the lock in shared
mode.  This turns back the exclusive lock starvation avoidance code;
see man page update for detailed description.

Use LK_NODDLKTREAT when doing lookup(9).

Reported and tested by:	pho
No objections from:	attilio
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2014-11-02 13:10:31 +00:00
Baptiste Daroussin
8a7314fcb5 use .Mt to mark up email addresses consistently (part6)
PR:		191174
Submitted by:	Franco Fichtner <franco at lastsummer.de>
2014-06-26 21:44:30 +00:00
Konstantin Belousov
5dc5cbb274 Document LK_TRYUPGRADE.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Approved by:	re (marius)
2013-10-06 15:59:06 +00:00
Andriy Gapon
c858f5cebd lock.9: fix incorrect descriptions of LK_SHARED and LK_DOWNGRADE behavior
Reviewed by:	attilio
MFC after:	5 days
X-MFC after:	r243900
2012-12-23 12:56:04 +00:00
Glen Barber
73bbeaa529 Typo and mdoc(7) style fixes.
PR:		168117
Submitted by:	Nobuyuki Koganemaru (kogane&jp!freebsd!org)
MFC after:	3 days
2012-05-20 16:43:47 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Joel Dahl
3030137a23 Remove superfluous paragraph macro. 2012-03-24 13:37:57 +00:00
Pawel Jakub Dawidek
d576deedb5 Constify arguments for locking KPIs where possible.
This enables locking consumers to pass their own structures around as const and
be able to assert locks embedded into those structures.

Reviewed by:	ed, kib, jhb
2011-11-16 21:51:17 +00:00
Attilio Rao
651175c9db Introduce support for adaptive spinning in lockmgr.
Actually, as it did receive few tuning, the support is disabled by
default, but it can opt-in with the option ADAPTIVE_LOCKMGRS.
Due to the nature of lockmgrs, adaptive spinning needs to be
selectively enabled for any interested lockmgr.
The support is bi-directional, or, in other ways, it will work in both
cases if the lock is held in read or write way.  In particular, the
read path is passible of further tunning using the sysctls
debug.lockmgr.retries and debug.lockmgr.loops .  Ideally, such sysctls
should be axed or compiled out before release.

Addictionally note that adaptive spinning doesn't cope well with
LK_SLEEPFAIL.  The reason is that many (and probabilly all) consumers
of LK_SLEEPFAIL are mainly interested in knowing if the interlock was
dropped or not in order to reacquire it and re-test initial conditions.
This directly interacts with adaptive spinning because lockmgr needs
to drop the interlock while spinning in order to avoid a deadlock
(further details in the comments inside the patch).

Final note: finding someone willing to help on tuning this with
relevant workloads would be either very important and appreciated.

Tested by:	jeff, pho
Requested by:	many
2009-06-17 01:55:42 +00:00
Attilio Rao
05fa71ba43 Remove the assertive KA_HELD and KA_UNHELD as long as they are dangerous,
and not really helpful.
2009-02-05 15:09:04 +00:00
Attilio Rao
031e0f3cd9 LK_NOWITNESS can be used now in lockmgr*() functions in order to skip
witness(4) checks on a per-instance basis.
2008-04-12 20:18:02 +00:00
Attilio Rao
48a12f8928 Commit manpages for lockmgr_args_rw(9) and lockmgr_rw(9). 2008-04-06 21:22:12 +00:00
Christian Brueffer
b4b811fa3c Document lockmgr_waiters(9).
Reviewed by:	attilio
2008-03-28 21:30:37 +00:00
Christian Brueffer
06e361fb0e New sentence -> new line. 2008-03-02 20:07:48 +00:00
Attilio Rao
78a25172e3 Fix lockstatus sorting on the top list. 2008-03-01 21:24:07 +00:00
Attilio Rao
7f527abc56 - Add the informations for lockmgr_args(9)
- Sort rightly lockstatus(9) in the manpage
2008-03-01 20:36:50 +00:00
Attilio Rao
008f392e2e Update lockmgr manpage with last lockmgr modifies:
- Remove LK_SLEEPFAIL and LK_NOWAIT for lockinit() and add LK_QUIET and
  LK_NOPROFILE
- Include sys/lock.h as mandatory for the lockmgr support
2008-03-01 20:05:20 +00:00
Attilio Rao
3220cdf4a3 Modify VOP_ISLOCKED() and lockstatus() prototypes in order to reflect
'thread' argument axing.
2008-02-25 19:12:01 +00:00
Christian Brueffer
af176d7306 Some language and mdoc style improvements. 2008-02-14 19:39:09 +00:00
Attilio Rao
f0c5fe2d1d Update manpage with lockmgr_assert() description. 2008-02-13 21:54:16 +00:00
Attilio Rao
abd94b3d59 Update manpage in order to reflect LK_NODUP and LK_NOWITNESS options
introduction.
2008-02-06 00:50:51 +00:00
Attilio Rao
623c393d65 Reflect lockcount() axing and lockmgr() prototype changing. 2008-01-24 14:17:52 +00:00
Attilio Rao
fa88526575 Add the newly added function lockmgr_recursed() to the manpages. 2008-01-22 20:16:09 +00:00
Christian Brueffer
584b589225 Fix typos. 2008-01-09 08:08:56 +00:00
Attilio Rao
fc2d483ef5 Add lockmgr_disown() and relative explanation. 2008-01-09 02:10:32 +00:00
Attilio Rao
100f241571 Trimm out now unused option LK_EXCLUPGRADE from the lockmgr namespace.
This option just adds complexity and the new implementation no longer
will support it, so axing it now that it is unused is probabilly the
better idea.

FreeBSD version is bumped in order to reflect the KPI breakage introduced
by this patch.

In the ports tree, kris found that only old OSKit code uses it, but as
it is thought to work only on 2.x kernels serie, version bumping will
solve any problem.
2007-12-28 00:38:13 +00:00
Christian Brueffer
3111fc98d5 Remove duplicate xref and add missing commas.
PR:		113891
Submitted by:	pluknet <pluknet@gmail.com>
Approved by:	re (blanket)
2007-06-21 16:39:25 +00:00
Julian Elischer
a280550abf Add some cross references to locking.9 from related pages. 2007-03-30 18:07:26 +00:00
John Baldwin
e7573e7ad7 Allow threads to atomically release rw and sx locks while waiting for an
event.  Locking primitives that support this (mtx, rw, and sx) now each
include their own foo_sleep() routine.
- Rename msleep() to _sleep() and change it's 'struct mtx' object to a
  'struct lock_object' pointer.  _sleep() uses the recently added
  lc_unlock() and lc_lock() function pointers for the lock class of the
  specified lock to release the lock while the thread is suspended.
- Add wrappers around _sleep() for mutexes (mtx_sleep()), rw locks
  (rw_sleep()), and sx locks (sx_sleep()).  msleep() still exists and
  is now identical to mtx_sleep(), but it is deprecated.
- Rename SLEEPQ_MSLEEP to SLEEPQ_SLEEP.
- Rewrite much of sleep.9 to not be msleep(9) centric.
- Flesh out the 'RETURN VALUES' section in sleep.9 and add an 'ERRORS'
  section.
- Add __nonnull(1) to _sleep() and msleep_spin() so that the compiler will
  warn if you try to pass a NULL wait channel.  The functions already have
  a KASSERT to that effect.
2007-03-09 22:41:01 +00:00
Konstantin Belousov
653ed924e4 Note that LK_UPGRADE may drop the shared lock before taking the
exclusive one.

Reviewed and edited by:	tegge
MFC after:	3 days
Approved by:	pjd (mentor)
2006-08-21 12:45:19 +00:00
Maxim Konovalov
f3a331b7c8 o Remove LK_REENABLE and LK_NOPAUSE lockinit(9) flags, add LK_NOSHARE.
MFC after:	1 week
2006-06-20 21:41:14 +00:00
Hiten Pandya
571dba6ec9 Use 'manual page' instead of 'man page' for consistency.
Approved by:	re (hrs)
2005-06-28 20:15:19 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Chad David
c4a7ba6e34 Update the prototype for lockinit to reflect that wmesg is a const char *. 2002-04-12 05:16:27 +00:00
Chad David
ffa2379289 Fixed bad wording/spelling in few paragraphs. 2002-03-24 00:31:38 +00:00
Chad David
5385e8bfab Merged all of the lockmgr functions into a single file (lock.9); as well,
some content and layout changes were made.

lock.9 had existed before but was never added to Makefile, so it was
never installed.  That is why the duplicate files were created in the
first place.

Reviewed by:	ru, alfred
2002-01-26 00:09:41 +00:00
Ruslan Ermilov
8271a1025c mdoc(7) police: tidy up the markup. 2002-01-10 12:32:38 +00:00
Chad David
f16b3c0de4 Update function definitions and required include files to reflect
the current state of the system.

Approved by: alfred
2001-12-26 23:14:04 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Ruslan Ermilov
3d45e180f4 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:31:11 +00:00
Dima Dorfman
70d51341bf mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
Ruslan Ermilov
ea3d1f093f mdoc(7) police: add the missing and required .Dd macro call. 2000-11-22 13:31:01 +00:00
Mark Murray
e5e600c900 Add some very crude man pages to try to induce folk to work on them.
Agreed to work on them:	jasone
2000-10-24 03:33:24 +00:00