|
|
Subscribe / Log in / New account

futex: Add support task local hash maps, FUTEX2_NUMA and FUTEX2_MPOL

From:  Sebastian Andrzej Siewior <bigeasy-AT-linutronix.de>
To:  linux-kernel-AT-vger.kernel.org
Subject:  [PATCH v11 00/19] futex: Add support task local hash maps, FUTEX2_NUMA and FUTEX2_MPOL
Date:  Mon, 07 Apr 2025 17:57:23 +0200
Message-ID:  <20250407155742.968816-1-bigeasy@linutronix.de>
Cc:  André Almeida <andrealmeid-AT-igalia.com>, Darren Hart <dvhart-AT-infradead.org>, Davidlohr Bueso <dave-AT-stgolabs.net>, Ingo Molnar <mingo-AT-redhat.com>, Juri Lelli <juri.lelli-AT-redhat.com>, Peter Zijlstra <peterz-AT-infradead.org>, Thomas Gleixner <tglx-AT-linutronix.de>, Valentin Schneider <vschneid-AT-redhat.com>, Waiman Long <longman-AT-redhat.com>, Sebastian Andrzej Siewior <bigeasy-AT-linutronix.de>
Archive-link:  Article

this is a follow up on
        https://lore.kernel.org/ZwVOMgBMxrw7BU9A@jlelli-thinkpadt...

and adds support for task local futex_hash_bucket.

This is the local hash map series with PeterZ FUTEX2_NUMA and
FUTEX2_MPOL plus a few fixes on top.

The complete tree is at
        https://git.kernel.org/pub/scm/linux/kernel/git/bigeasy/s...
        https://git.kernel.org/pub/scm/linux/kernel/git/bigeasy/s... futex_local_v11

v10…v11: https://lore.kernel.org/all/20250312151634.2183278-1-bige...
  - PeterZ' fixups, changes to the local hash series have been folded
    into the earlier patches so things are not added and renamed later
    and the functionality is changed.

  - vmalloc_huge() has been implemented on top of vmalloc_huge_node()
    and the NOMMU bots have been adjusted. akpm asked for this.

  - wake_up_var() has been removed from __futex_pivot_hash(). It is
    enough to wake the userspace waiter after the final put so it can
    perform the resize itself.

  - Changed to logic in futex_pivot_pending() so it does not block for
    the user. It waits for __futex_pivot_hash() which follows the logic
    in __futex_pivot_hash().

  - Updated kernel doc for __futex_hash().

  - Patches 17+ are new:
    - Wire up PR_FUTEX_HASH_SET_SLOTS in "perf bench futex"
    - Add "immutable" mode to PR_FUTEX_HASH_SET_SLOTS to avoid resizing
      the local hash any further. This avoids rcuref usage which is
      noticeable in "perf bench futex hash"

Peter Zijlstra (8):
  mm: Add vmalloc_huge_node()
  futex: Move futex_queue() into futex_wait_setup()
  futex: Pull futex_hash() out of futex_q_lock()
  futex: Create hb scopes
  futex: Create futex_hash() get/put class
  futex: Create private_hash() get/put class
  futex: Implement FUTEX2_NUMA
  futex: Implement FUTEX2_MPOL

Sebastian Andrzej Siewior (11):
  rcuref: Provide rcuref_is_dead().
  futex: Acquire a hash reference in futex_wait_multiple_setup().
  futex: Decrease the waiter count before the unlock operation.
  futex: Introduce futex_q_lockptr_lock().
  futex: Create helper function to initialize a hash slot.
  futex: Add basic infrastructure for local task local hash.
  futex: Allow automatic allocation of process wide futex hash.
  futex: Allow to resize the private local hash.
  tools headers: Synchronize prctl.h ABI header
  tools/perf: Allow to select the number of hash buckets.
  futex: Allow to make the private hash immutable.

 include/linux/futex.h                  |  36 +-
 include/linux/mm_types.h               |   7 +-
 include/linux/mmap_lock.h              |   4 +
 include/linux/rcuref.h                 |  22 +-
 include/linux/vmalloc.h                |   9 +-
 include/uapi/linux/futex.h             |  10 +-
 include/uapi/linux/prctl.h             |   6 +
 init/Kconfig                           |  10 +
 io_uring/futex.c                       |   4 +-
 kernel/fork.c                          |  24 +
 kernel/futex/core.c                    | 794 ++++++++++++++++++++++---
 kernel/futex/futex.h                   |  73 ++-
 kernel/futex/pi.c                      | 300 +++++-----
 kernel/futex/requeue.c                 | 480 +++++++--------
 kernel/futex/waitwake.c                | 201 ++++---
 kernel/sys.c                           |   4 +
 mm/nommu.c                             |  18 +-
 mm/vmalloc.c                           |  11 +-
 tools/include/uapi/linux/prctl.h       |  44 +-
 tools/perf/bench/Build                 |   1 +
 tools/perf/bench/futex-hash.c          |   7 +
 tools/perf/bench/futex-lock-pi.c       |   5 +
 tools/perf/bench/futex-requeue.c       |   6 +
 tools/perf/bench/futex-wake-parallel.c |   9 +-
 tools/perf/bench/futex-wake.c          |   4 +
 tools/perf/bench/futex.c               |  60 ++
 tools/perf/bench/futex.h               |   5 +
 27 files changed, 1585 insertions(+), 569 deletions(-)
 create mode 100644 tools/perf/bench/futex.c

-- 
2.49.0




Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds