lkml.org 
[lkml]   [2016]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 1/3] locking/mutex: Rework mutex::owner
On 08/23/2016 08:46 AM, Peter Zijlstra wrote:
> /*
> * Simple, straightforward mutexes with strict semantics:
> @@ -48,13 +49,9 @@
> * locks and tasks (and only those tasks)
> */
> struct mutex {
> - /* 1: unlocked, 0: locked, negative: locked, possible waiters */
> - atomic_t count;
> + atomic_long_t owner;
> spinlock_t wait_lock;
> struct list_head wait_list;
> -#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
> - struct task_struct *owner;
> -#endif
> #ifdef CONFIG_MUTEX_SPIN_ON_OWNER
> struct optimistic_spin_queue osq; /* Spinner MCS lock */
> #endif

I think you should put the wait_lock and osq next to each other to save
8 bytes in space on 64-bit machines.

Cheers,
Longman

\
 
 \ /
  Last update: 2016-09-17 09:57    [W:0.229 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site