From patchwork Thu Nov 4 19:57:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Oskolkov X-Patchwork-Id: 12603749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0818EC433EF for ; Thu, 4 Nov 2021 19:58:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9CB2A61252 for ; Thu, 4 Nov 2021 19:58:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9CB2A61252 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=posk.io Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9FDEC6B0072; Thu, 4 Nov 2021 15:58:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A6EA6B0075; Thu, 4 Nov 2021 15:58:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 821196B0073; Thu, 4 Nov 2021 15:58:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id 707526B0071 for ; Thu, 4 Nov 2021 15:58:14 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2AA821856D000 for ; Thu, 4 Nov 2021 19:58:14 +0000 (UTC) X-FDA: 78772309266.26.DA2688A Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf24.hostedemail.com (Postfix) with ESMTP id A1D67B0000BA for ; Thu, 4 Nov 2021 19:58:10 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id t7so6361302pgl.9 for ; Thu, 04 Nov 2021 12:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posk.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vuCt9AADoX+KE8RwAMppULbU69yu+KMFmMlPzvldw0A=; b=RtBgCuisgtMAvqQuwqPxumatdbc6iy2ebCURPV+sx7JsapFwfEDpg2Crb6Pw/VRQ3d gz6OuCg0CPqG/GgGvwV5t0ZJkS7XHol/EK3tp1MDePVUg9iZYnYI2Wl3Dj4NY4VLNJYn Cp/40yEncJTi+aEetB93uwAUANHZja1+lhkkjUEg6+uGuJWn9Rm/ouGoPB83yH3k44ez jNpSq9iovOXLH2Yf9zU7+K5mFXw6WNG8ZokeULaPeg7Q/Y1MvQboI3kTRHJJUi7gfeZb AQ4jBcmpvLbOCaCQMRS0ZmgQK2tb/RwrUFSgRFUxwQNvPdSStFtezmG+EO8VOzLacmpr 2zHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vuCt9AADoX+KE8RwAMppULbU69yu+KMFmMlPzvldw0A=; b=EvOOMnjCWmDgk3IVtMMe7UAdeyavstKc3WDs5jGoZHLkNfyjaUq8d4331azCrM6WBO WbgR7uemOwN/iS4hWY2WEjAl2MR664L88RV/v9Yroy26hwIPtNHeK72dnxTBFsxigBLo vjMLysvJTUOUB/XGnMLcioTZhKJDwGnLtMCmsCT3GA9KDvU0Va6HDBMcpI3rLAwC/246 Ul6Rc1phkmgl8VUW8hPpt+8sed2sLCI9l0pec+bGtIZH3A8mzS5nP6qMQyi5AeTzScwF f1EMrCk5eWoYL3WWZZrb/UvoIMALRDPr0Kcc1F3YI1zO+vOlVjR1HKk8ThJEPB1qPHWn MgcQ== X-Gm-Message-State: AOAM532WT/JA+Wn+6nCT01J9k20+taE/9Oh+t7dW5n2LK3jxm5W86ZEK B2IblB0O/Vsa/SUU0OkBCa1V7w== X-Google-Smtp-Source: ABdhPJyl57LyLIeBB16p5BTph0mr8XHpKbrQS9TmDzXCs+4x0OcRQ1aItWJBA2Z+togJ+PGlK6wUUA== X-Received: by 2002:a63:2c8:: with SMTP id 191mr39910180pgc.293.1636055889635; Thu, 04 Nov 2021 12:58:09 -0700 (PDT) Received: from posk-g1.lan (23-118-52-46.lightspeed.sntcca.sbcglobal.net. [23.118.52.46]) by smtp.gmail.com with ESMTPSA id w185sm5487853pfb.38.2021.11.04.12.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 12:58:09 -0700 (PDT) From: Peter Oskolkov X-Google-Original-From: Peter Oskolkov To: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Andrew Morton , Dave Hansen , Andy Lutomirski , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Cc: Paul Turner , Ben Segall , Peter Oskolkov , Peter Oskolkov , Andrei Vagin , Jann Horn , Thierry Delisle Subject: [PATCH v0.8 0/6] sched,mm,x86/uaccess: implement User Managed Concurrency Groups Date: Thu, 4 Nov 2021 12:57:58 -0700 Message-Id: <20211104195804.83240-1-posk@google.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=posk.io header.s=google header.b=RtBgCuis; dmarc=none; spf=pass (imf24.hostedemail.com: domain of posk@posk.io designates 209.85.215.171 as permitted sender) smtp.mailfrom=posk@posk.io X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A1D67B0000BA X-Stat-Signature: 1rswxud97q5b4qacwfbju8p3oop5gtaz X-HE-Tag: 1636055890-308199 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: User Managed Concurrency Groups (UMCG) is an M:N threading subsystem/toolkit that lets user space application developers implement in-process user space schedulers. Key changes from the previous patchset https://lore.kernel.org/all/20211012232522.714898-1-posk@google.com/: - added libumcg tools/lib/umcg; - worker "wakeup" is reworked so that it is now purely a userspace op, instead of waking the thread in order for it to block on return to the userspace immediately; - a couple of minor fixes and refactorings. These big things remain to be addressed (in no particular order): - support tracing/debugging - make context switches faster (see umcg_do_context_switch in umcg.c) - support other architectures - cleanup and post selftests in tools/testing/selftests/umcg/ - allow cross-mm wakeups (securely) Peter Oskolkov (6): sched/umcg: add WF_CURRENT_CPU and externise ttwu mm, x86/uaccess: add userspace atomic helpers sched/umcg: implement UMCG syscalls sched/umcg, lib/umcg: implement libumcg sched/umcg: add Documentation/userspace-api/umcg.txt sched/umcg, lib/umcg: add tools/lib/umcg/libumcg.txt Documentation/userspace-api/umcg.txt | 598 ++++++++++++ arch/x86/entry/syscalls/syscall_64.tbl | 2 + arch/x86/include/asm/uaccess_64.h | 93 ++ fs/exec.c | 1 + include/linux/sched.h | 71 ++ include/linux/syscalls.h | 3 + include/linux/uaccess.h | 46 + include/uapi/asm-generic/unistd.h | 6 +- include/uapi/linux/umcg.h | 137 +++ init/Kconfig | 10 + kernel/entry/common.c | 4 +- kernel/exit.c | 5 + kernel/sched/Makefile | 1 + kernel/sched/core.c | 12 +- kernel/sched/fair.c | 4 + kernel/sched/sched.h | 15 +- kernel/sched/umcg.c | 949 +++++++++++++++++++ kernel/sys_ni.c | 4 + mm/maccess.c | 264 ++++++ tools/lib/umcg/.gitignore | 4 + tools/lib/umcg/Makefile | 11 + tools/lib/umcg/libumcg.c | 1201 ++++++++++++++++++++++++ tools/lib/umcg/libumcg.h | 299 ++++++ tools/lib/umcg/libumcg.txt | 438 +++++++++ 24 files changed, 4166 insertions(+), 12 deletions(-) create mode 100644 Documentation/userspace-api/umcg.txt create mode 100644 include/uapi/linux/umcg.h create mode 100644 kernel/sched/umcg.c 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/lib/umcg/libumcg.txt base-commit: 8ea9183db4ad8afbcb7089a77c23eaf965b0cacd --- 2.25.1