lkml.org 
[lkml]   [2013]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC patch 0/5] futex: Allow lockless empty check of hashbucket plist in futex_wake()

* Peter Zijlstra <peterz@infradead.org> wrote:

> On Sun, Dec 01, 2013 at 01:10:22PM +0100, Ingo Molnar wrote:
>
> > But more importantly, since these are all NUMA systems, would it
> > make sense to create per node hashes on NUMA? Each futex would be
> > enqueued into the hash belonging to its own page's node.
>
> Can't do that; we hash on vaddr, the actual page can move between
> nodes while a futex is queued.

Hm, indeed. We used to hash on the physical address - the very first
futex version from Rusty did:

+static inline struct list_head *hash_futex(struct page *page,
+ unsigned long offset)
+{
+ unsigned long h;
+
+ /* struct page is shared, so we can hash on its address */
+ h = (unsigned long)page + offset;
+ return &futex_queues[hash_long(h, FUTEX_HASHBITS)];
+}

But this was changed to uaddr keying in:

69e9c9b518fc [PATCH] Unpinned futexes v2: indexing changes

(commit from the linux historic git tree.)

I think this design aspect could perhaps be revisited/corrected - in
what situations can a page move from under a futex? Only via the
memory migration system calls, or are there other channels as well?
Swapping should not affect the address, as the pages are pinned,
right?

Keeping the page invariant would bring significant performance
advantages to hashing.

> This would mean that the waiting futex is queued on another node
> than the waker is looking.

Yeah, that cannot work.

Thanks,

Ingo


\
 
 \ /
  Last update: 2013-12-01 18:21    [W:0.084 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site