From patchwork Mon Nov 22 21:13:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Oskolkov X-Patchwork-Id: 12632783 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBFFCC433FE for ; Mon, 22 Nov 2021 21:14:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A8E86B0071; Mon, 22 Nov 2021 16:13:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 609996B0072; Mon, 22 Nov 2021 16:13:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 435D66B0073; Mon, 22 Nov 2021 16:13:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 323DD6B0071 for ; Mon, 22 Nov 2021 16:13:43 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EB48E8CA39 for ; Mon, 22 Nov 2021 21:13:32 +0000 (UTC) X-FDA: 78837817506.18.606509F Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf18.hostedemail.com (Postfix) with ESMTP id 8D3074002093 for ; Mon, 22 Nov 2021 21:13:30 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id y14-20020a17090a2b4e00b001a5824f4918so301039pjc.4 for ; Mon, 22 Nov 2021 13:13:32 -0800 (PST) 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=PSZbIIJ12X4cKbIfk8F4IXpXcCyw8aHucx8N+UnZR24=; b=KSoGHvCiWAIB/jwJ7MpdQKfFN3d1mvwbSqjegT4yVZLZ2maZHiuoxS93G/d3WVUgAt CF2P2NtagWfkNRcbxnV0kPy08IxVJC3pldLpb92wGlS9rJ7qdu2Izik1mhoBdERcx/EM BTOz2zUwxuR21uy8x/Xm9jVgHFNF2956x7V+mLChz+hGBaHmv1Z24O05hEUaDPrFz5eF bPkVfc2mb5b2/txxc+aPHlMtBW+O2EVQwb33zZMMqC/oPgGQ73mOo5EzoVaMuIGKO9b8 EklelsTy4ki7wVeAIc2X14R6f/m/DWVFyvkUJ3dPVrfv4F8oQ42pGSZViv+N+ORRr2yS PcFg== 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=PSZbIIJ12X4cKbIfk8F4IXpXcCyw8aHucx8N+UnZR24=; b=HT7zxfILgyVLnJiUGisevnJgTK6ecLwemw+ozUkcCTivsEAc53j47hy0q3Yhky7y7y zh0z7y+qEEoeDUgfuTd8ZdLg/xke8fO1IxijsyJ4rEh8lxmmWdiVXRsxPEbX/rI5TgkB D0yfqOmqwt6KLDHYOEZUwWWKWhSGrJ+CIrYoSSqprlwEhCHOU2iT/YF6g43KsxKxgUcG r2YvF3epwDFmE3CcPVuKB4/K4UZUGe2lbLklLlI/RNf4BOBpnvCN60Cl8fG0e6ORCskE kDaEW5yTIyXfqPgsPhQISQcJ3PH+T36aKfxqdT3kECIccl9y8AP5tZ3y1yVT6UfmuR+g WJ1Q== X-Gm-Message-State: AOAM53347eN1XaJJ00jwTq13UZERZZukVjZaU1l322uylI2rkE9Nq+1r HErwrp+7PT7iAEyeBuO6pNiE2w== X-Google-Smtp-Source: ABdhPJzF/NM3OBcyfx8JimuF5YAQlD65oBAF4tFkp+dTome7P7AIGUYAxriUt8BsU9JswlMN1l5Ifg== X-Received: by 2002:a17:903:248c:b0:142:9bf:8b0 with SMTP id p12-20020a170903248c00b0014209bf08b0mr111356plw.70.1637615611410; Mon, 22 Nov 2021 13:13:31 -0800 (PST) Received: from posk-p1g4.localdomain (23-118-52-46.lightspeed.sntcca.sbcglobal.net. [23.118.52.46]) by smtp.gmail.com with ESMTPSA id h3sm10453671pfi.207.2021.11.22.13.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 13:13:30 -0800 (PST) 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.9.1 0/6] sched,mm,x86/uaccess: implement User Managed Concurrency Groups Date: Mon, 22 Nov 2021 13:13:21 -0800 Message-Id: <20211122211327.5931-1-posk@google.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 8D3074002093 X-Stat-Signature: kmtjd1g9y39hksa7o1dyixyijrjh6stf Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=posk.io header.s=google header.b=KSoGHvCi; dmarc=none; spf=pass (imf18.hostedemail.com: domain of posk@posk.io designates 209.85.216.48 as permitted sender) smtp.mailfrom=posk@posk.io X-HE-Tag: 1637615610-177669 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. This v0.9.1 patchset is the same as v0.9, where u32/u64 in uapi/linux/umcg.h are replaced with __u32/__u64, as test robot/lkp does not recognize u32/u64 for some reason. v0.9 is v0.8 rebased on top of the current tip/sched/core, with a fix in umcg_update_state of an issue reported by Tao Zhou. Key changes from patchset v0.7: 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 | 7 +- 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 | 1202 ++++++++++++++++++++++++ tools/lib/umcg/libumcg.h | 299 ++++++ tools/lib/umcg/libumcg.txt | 438 +++++++++ 24 files changed, 4168 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: cb0e52b7748737b2cf6481fdd9b920ce7e1ebbdf --- 2.25.1