From patchwork Fri Sep 6 05:12:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrii Nakryiko X-Patchwork-Id: 13793242 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 7BBDDC54FC6 for ; Fri, 6 Sep 2024 05:12:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BF756B007B; Fri, 6 Sep 2024 01:12:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06F8B6B0082; Fri, 6 Sep 2024 01:12:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E78D56B0085; Fri, 6 Sep 2024 01:12:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id CB1376B007B for ; Fri, 6 Sep 2024 01:12:18 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4A8F0C0E7C for ; Fri, 6 Sep 2024 05:12:18 +0000 (UTC) X-FDA: 82533142356.03.F71DE24 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf17.hostedemail.com (Postfix) with ESMTP id B029E40010 for ; Fri, 6 Sep 2024 05:12:16 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KVGFLIE4; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of andrii@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=andrii@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725599464; a=rsa-sha256; cv=none; b=ffu/wtJ8uPx0uZW8peUDVouJ9pnRajdkYM7gtlu10PD/saZ02htLP8ElmhmKfX7UsbSn1X wyEd5XYT3MFHr6MdU8HTNnixaljt0xGkksAWx3Db5wOLe6MgW4Xz0WjwAdTy6ReWTLDrWX 8qUviOpM5wPILMv/EE45pXan929iKF0= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KVGFLIE4; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of andrii@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=andrii@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725599464; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=LgttL3V6TkiHkHnV0Cifh4VkV2qHWcUIkBpcIV1h0jA=; b=Eup4QwHutD9WstXU5CH3ZyvbveKu+HYhxiPfYy3pjxU8RolkdbIeaV+3rthxqW6I0hBvwQ 2M/zbHMi3N3bToHntRmuHKYg4WlmQCaFtDHYx6DVKZd+oSDVA+9Dg0qifz5m8+vCTR7g4R fhMaJnIFNrfxNmXKXc7TCbaT0v7kbc4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A6152A4401B; Fri, 6 Sep 2024 05:12:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79B52C4CEC6; Fri, 6 Sep 2024 05:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725599535; bh=LZZWxcMxT163bv4rhTf6ukqGVdnUPsJwkRVsmldznFU=; h=From:To:Cc:Subject:Date:From; b=KVGFLIE4NNT2z2HPWj+onSPv+4W63UgxRtZYbA9/4wN7mWEtPIA13IFFsE3Jap9wk WCrU0CorabroVWe2HzB3NLQVzjguncFkU8SHgU1+l0ocQBpWPSuImDeYvAGnBM4WYA LDMLONQuFvzccUpz2HaW2X8Stl+jobAQgBj/p1xBsew7qUAcYuKd33vl22hNKlVTMC 4waoFgvVHA7deDCOcHyDYkHIYFbNmuWze2OFKNU2Gkz39ymwuhd8V6zzxs7uwgWaP/ KX7ScbrpFyIVW588Q3aJPDkXqAZAuLJe6ja1PWZyXzasVH/zvC8ijRuF/9j5hlDb1i 0KBtC0zAegBfA== From: Andrii Nakryiko To: linux-trace-kernel@vger.kernel.org, peterz@infradead.org, oleg@redhat.com Cc: rostedt@goodmis.org, mhiramat@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, jolsa@kernel.org, paulmck@kernel.org, willy@infradead.org, surenb@google.com, akpm@linux-foundation.org, linux-mm@kvack.org, mjguzik@gmail.com, brauner@kernel.org, jannh@google.com, Andrii Nakryiko Subject: [PATCH 0/2] uprobes,mm: speculative lockless VMA-to-uprobe lookup Date: Thu, 5 Sep 2024 22:12:03 -0700 Message-ID: <20240906051205.530219-1-andrii@kernel.org> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-Rspamd-Queue-Id: B029E40010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: isr6qb595aw3ukh1krdpbsnsofjyki9e X-HE-Tag: 1725599536-582461 X-HE-Meta: U2FsdGVkX1/mOwzUDuY7pUWo8S3o3YUm9/DAvdHQ+0liN8jy631XT8ffPGQWT0miy9SnrzCz8L7JBrUfMyCRORVRyYjrxPxD5BKnBHGNvDPWlbE5ZojStNgKShCw0YAtSPt1w7AeRAp1jUiguPlCswkMmfr5lQe4KS3eUzA3YM6t6AgooGTmqsBPs7NmcUp4Il8COQhMojs/EoV2x6i2asu5DHrPmfaZngYeCvIjgaCr0xJQt4NreJmEfG+kzXM8NtLMVJg/ulVSg0qaVDeO2icxbf33tK80GKiDnEQ7nZ2fARLR001+F2ysgS34Gi4FH+iBVBdNIVqCe5tSlb8NBq10AIeWJBjmafSXJkBF+X2Pc4xtu2xhlvZQsgOzlN4GCQxOQA3RhsutRhaVpa8cKELjV2N2C20+aI34F17ZIljm6gt6X9N48P4mm/egS2wYVJaK9LhiZmXjidiyV0BtHfU/1UY3P6skP2h22QVOEftVCgH4kKxg58mCTrwQDuccsk8+fq+zz8QhWGZhR6FaYV9rlrUfkYdoqruRz7ddH7PBIa5yDYdiJWfLBhNEi3mxWrWOJbQU4TJ8CVWtpDR58nV/mp5SQO1BuafsoRc5QCxle81TWXG9ameahZ0cRvinPue1A5M2SurG6O0uiIubBUh7BNcFuzskhEbV5734WhdORDLlKpQZIZOdFMSz8AgSs6J1CberIlmHntY7ay9mnfyP4JHqQQ8pD20gM8Z6Z749MVxzHgxE0xhhhaawvyincOejHfS7cFO4rpRYxxtywzrLL/0+Gh05NLJYInXbLzTNHb6yIPrVEXrxA/9/PfCu9jet8e4z5Bek4ZyEKw+USnVdZH0P3nUNQdeOm7SaWlMd7TzdMwrrSr419jP6G10vMzWh6LJzk23/GCN1PywP9620gI0CG4xIkEXOuQoTLTsK6A1tBmSZtnv3MuCOUIjZP7IU5v/mv7VAO186p1V UlcPUaY4 kBIg5TF+cuyzaXuARwPuUoioN4LepIBGCDILzIf/SAHz+ICSUVGEedP52aYFHDaoChMF/bDweYa1B4K6NLmYScIrCdKETL7IhTvb++sYNCtsuIUrlKaQk5PGOnO7nWweqVCIAY4opXDwqCmPCVjBNHFXVsvIHGr5Ra6ceTHCxHWHfHAzhb8U73GbxfWDsgzX/zibq 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: List-Subscribe: List-Unsubscribe: Implement speculative (lockless) resolution of VMA to inode to uprobe, bypassing the need to take mmap_lock for reads, if possible. Patch #1 by Suren adds mm_struct helpers that help detect whether mm_struct were changed, which is used by uprobe logic to validate that speculative results can be trusted after all the lookup logic results in a valid uprobe instance. I ran a few will-it-scale benchmarks to sanity check that patch #1 doesn't introduce any noticeable regressions. Which it seems it doesn't. Andrii Nakryiko (1): uprobes: add speculative lockless VMA-to-inode-to-uprobe resolution Suren Baghdasaryan (1): mm: introduce mmap_lock_speculation_{start|end} include/linux/mm_types.h | 3 +++ include/linux/mmap_lock.h | 53 +++++++++++++++++++++++++++++++-------- kernel/events/uprobes.c | 51 +++++++++++++++++++++++++++++++++++++ kernel/fork.c | 3 --- 4 files changed, 97 insertions(+), 13 deletions(-)