svn commit: r207460 - head/sys/vm

Attilio Rao attilio at freebsd.org
Sat May 1 14:49:34 UTC 2010


2010/5/1 Kip Macy <kmacy at freebsd.org>:
> Author: kmacy
> Date: Sat May  1 03:41:21 2010
> New Revision: 207460
> URL: http://svn.freebsd.org/changeset/base/207460
>
> Log:
>  Update locking comment above vm_page:
>         - re-assign page queue lock "Q"
>         - assign page lock "P"
>         - update several uncommented fields
>         - observe that hold_count is now protected by the page lock "P"
>
> Modified:
>  head/sys/vm/vm_page.h
>
> Modified: head/sys/vm/vm_page.h
> ==============================================================================
> --- head/sys/vm/vm_page.h       Sat May  1 02:53:43 2010        (r207459)
> +++ head/sys/vm/vm_page.h       Sat May  1 03:41:21 2010        (r207460)
> @@ -90,20 +90,21 @@
>  *     and sundry status bits.
>  *
>  *     Fields in this structure are locked either by the lock on the
> - *     object that the page belongs to (O) or by the lock on the page
> - *     queues (P).
> + *     object that the page belongs to (O), its corresponding page lock (P),
> + *     or by the lock on the page queues (Q).
> + *
>  */
>
>  TAILQ_HEAD(pglist, vm_page);
>
>  struct vm_page {
> -       TAILQ_ENTRY(vm_page) pageq;     /* queue info for FIFO queue or free list (P) */
> +       TAILQ_ENTRY(vm_page) pageq;     /* queue info for FIFO queue or free list (Q) */
>        TAILQ_ENTRY(vm_page) listq;     /* pages in same object (O)     */
>        struct vm_page *left;           /* splay tree link (O)          */
>        struct vm_page *right;          /* splay tree link (O)          */
>
> -       vm_object_t object;             /* which object am I in (O,P)*/
> -       vm_pindex_t pindex;             /* offset into object (O,P) */
> +       vm_object_t object;             /* which object am I in (O,Q)*/
> +       vm_pindex_t pindex;             /* offset into object (O,Q) */

This notation is ambigous. It doesn't let understand if the lock may
be held both together or not, which rules happen for reading/writing
such values, etc.
May you please follow well-known patterns like the tables in
subr_turnstile.c ? (+ for both of them, / for one of them, clarify if
it is safe to read them with just one lock of them held, etc).

Attilio


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


More information about the svn-src-all mailing list