Skip to content

RFC UMCG early preview/RFC patchset

Peter Oskolkov linux-api lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest9 patches 25 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9sched/umcg: add UMCG syscall stubs and CONFIG_UMCGarch/x86/entry/syscalls/syscall_64.tbl include/uapi/asm-generic/unistd.h init/Kconfig +1 more+58 -10 replies
2/9sched/umcg: add uapi/linux/umcg.h and sched/umcg.cinclude/linux/syscalls.h include/uapi/linux/umcg.h kernel/sched/Makefile +1 more+223 -00 replies
3/9sched: add WF_CURRENT_CPU and externise ttwukernel/sched/core.c kernel/sched/fair.c kernel/sched/sched.h+14 -80 replies
4/9sched/umcg: implement core UMCG APIinclude/linux/sched.h kernel/sched/core.c kernel/sched/umcg.c +1 more+282 -77 replies
5/9lib/umcg: implement UMCG core API for userspacetools/lib/umcg/.gitignore tools/lib/umcg/Makefile tools/lib/umcg/libumcg.c +1 more+519 -00 replies
6/9selftests/umcg: add UMCG core API selftesttools/testing/selftests/umcg/.gitignore tools/testing/selftests/umcg/Makefile tools/testing/selftests/umcg/umcg_core_test.c+362 -00 replies
7/9sched/umcg: add UMCG server/worker API (early RFC)include/linux/mm_types.h include/linux/syscalls.h kernel/fork.c +4 more+845 -91 reply
8/9lib/umcg: add UMCG server/worker API (early RFC)tools/lib/umcg/libumcg.c tools/lib/umcg/libumcg.h+330 -00 replies
9/9selftests/umcg: add UMCG server/worker API selftesttools/testing/selftests/umcg/.gitignore tools/testing/selftests/umcg/Makefile tools/testing/selftests/umcg/umcg_test.c+479 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH v0.1 0/9] UMCG early preview/RFC patchset

As indicated earlier in the FUTEX_SWAP patchset:

https://lore.kernel.org/lkml/[email protected]/

"Google Fibers" is a userspace scheduling framework
used widely and successfully at Google to improve in-process workload isolation and response latencies. We are working on open-sourcing this framework, and UMCG (User-Managed Concurrency Groups) kernel patches are intended as the foundation of this.

This patchset is "early preview/RFC" - an earlier version of the "core UMCG API" was discussed offlist, and I was asked to post "what I have" to LKML before I consider the work ready for a full review.

Notes:
- the first six patches cover "core UMCG API" and are more "ready" than the last three, in the sense that I expect to see few, if any, material changes to them, unless the whole approach is NACKed;
- the last three patches cover "server/worker UMCG API" and need more work and testing:
- while I'm not aware of any specific issues with them, I have not implemented and/or tested, yet, many important use cases, such as:
- tracing
- signals/interrupts
- explicit preemption of workers other than cooperative wait/swap
- comments/documentation is missing in many important places, or maybe even wrong/outdated.

As such, please pay more attention to the high-level intended behavior and design than to things like patch organization, contents of commit messages, comments or indentation, especially in the last three patches.

Unless the feedback here points to a different approach, my next step is to add timeout handling to sys_umcg_wait/sys_umcg_swap, as this will open up a lot of Google-internal tests that cover most of use/corner cases other than explicit preemption of workers (Google Fibers use cooperative scheduling features only). Then I'll work on issues uncovered by those tests. Then I'll address preemption and tracing.

This work is loosely based on Google-internal SwitchTo and SwitchTo Groups kernel patches developed by Paul Turner and Ben Segall.

Peter Oskolkov (9):
sched/umcg: add UMCG syscall stubs and CONFIG_UMCG sched/umcg: add uapi/linux/umcg.h and sched/umcg.c
sched: add WF_CURRENT_CPU and externise ttwu sched/umcg: implement core UMCG API lib/umcg: implement UMCG core API for userspace selftests/umcg: add UMCG core API selftest sched/umcg: add UMCG server/worker API (early RFC) lib/umcg: add UMCG server/worker API (early RFC) selftests/umcg: add UMCG server/worker API selftest

 arch/x86/entry/syscalls/syscall_64.tbl        |   11 +
 include/linux/mm_types.h                      |    5 +
 include/linux/sched.h                         |    7 +-
 include/linux/syscalls.h                      |   14 +
 include/uapi/asm-generic/unistd.h             |   25 +-
 include/uapi/linux/umcg.h                     |   70 ++
 init/Kconfig                                  |   10 +
 kernel/fork.c                                 |   11 +
 kernel/sched/Makefile                         |    1 +
 kernel/sched/core.c                           |   17 +-
 kernel/sched/fair.c                           |    4 +
 kernel/sched/sched.h                          |   15 +-
 kernel/sched/umcg.c                           | 1114 +++++++++++++++++
 kernel/sched/umcg.h                           |   96 ++
 kernel/sys_ni.c                               |   13 +
 mm/init-mm.c                                  |    4 +
 tools/lib/umcg/.gitignore                     |    4 +
 tools/lib/umcg/Makefile                       |   11 +
 tools/lib/umcg/libumcg.c                      |  572 +++++++++
 tools/lib/umcg/libumcg.h                      |  262 ++++
 tools/testing/selftests/umcg/.gitignore       |    3 +
 tools/testing/selftests/umcg/Makefile         |   15 +
 tools/testing/selftests/umcg/umcg_core_test.c |  347 +++++
 tools/testing/selftests/umcg/umcg_test.c      |  475 +++++++
 24 files changed, 3096 insertions(+), 10 deletions(-)
 create mode 100644 include/uapi/linux/umcg.h
 create mode 100644 kernel/sched/umcg.c
 create mode 100644 kernel/sched/umcg.h
 create mode 100644 tools/lib/umcg/.gitignore
 create mode 100644 tools/lib/umcg/Makefile
 create mode 100644 tools/lib/umcg/libumcg.c
 create mode 100644 tools/lib/umcg/libumcg.h
 create mode 100644 tools/testing/selftests/umcg/.gitignore
 create mode 100644 tools/testing/selftests/umcg/Makefile
 create mode 100644 tools/testing/selftests/umcg/umcg_core_test.c
 create mode 100644 tools/testing/selftests/umcg/umcg_test.c
Signature · 1 line
2.31.1.818.g46aad6cb9e-goog