Re: [PATCH 1/6] mlock: only hold mmap_sem in shared mode when

From: George Spelvin
Date: Fri Dec 10 2010 - 14:07:36 EST


How about (bugfixed):

bool cond_break_mutex(struct mutex *mutex)
{
if (!mutex_is_contended(mutex))
return false;
mutex_unlock(mutex);
mutex_lock(mutex);
return true;
}

It would be possible to share work between the unlock and lock slowpaths
(particularly the wait_lock acquisition), but that's probably more
maintenance effort than it's worth.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/