Re: [PATCH v8 3/6] MCS Lock: optimizations and extra comments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 20, 2014 at 5:24 PM, Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx> wrote:
> From: Jason Low <jason.low2@xxxxxx>

> @@ -41,8 +47,11 @@ void mcs_spin_lock(struct mcs_spinlock **lock, struct mcs_spinlock *node)
>
>         prev = xchg(lock, node);
>         if (likely(prev == NULL)) {
> -               /* Lock acquired */
> -               node->locked = 1;
> +               /* Lock acquired, don't need to set node->locked to 1
> +                * as lock owner and other contenders won't check this value.
> +                * If a debug mode is needed to audit lock status, then
> +                * set node->locked value here.
> +                */

It would also be good to mention why the value is not checked
in this comment. Perhaps something like the following:

/*
 * Lock acquired, don't need to set node->locked to 1. Threads
 * only spin on its own node->locked value for lock acquisition.
 * However, since this thread can immediately acquire the lock
 * and does not proceed to spin on its own node->locked, this
 * value won't be used. If a debug mode is needed to
 * audit lock status, then set node->locked value here.
 */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]