From patchwork Fri Jan 28 13:09:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 12728505 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 B1558C433EF for ; Fri, 28 Jan 2022 13:10:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F4B16B0083; Fri, 28 Jan 2022 08:10:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5807C6B0074; Fri, 28 Jan 2022 08:10:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 334E06B0080; Fri, 28 Jan 2022 08:10:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 15AB66B007D for ; Fri, 28 Jan 2022 08:10:11 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CBB9618189509 for ; Fri, 28 Jan 2022 13:10:10 +0000 (UTC) X-FDA: 79079728980.29.FF4E051 Received: from server.lespinasse.org (server.lespinasse.org [63.205.204.226]) by imf10.hostedemail.com (Postfix) with ESMTP id 67B96C0006 for ; Fri, 28 Jan 2022 13:10:10 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-52-ed; t=1643375407; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=DmGgYXIxuiNl6v6cMRPQigMIgjtXtbGpaAKFRJYhv/I=; b=GDRiMZ9S0azV2Kn+iE+ZKlmXOxOZS3W4CUWO2Lkt9Jj7y0ZoRy+qf3ZSGPIvMindJ9Gyz LoMV0lL00tULmr4DQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-52-rsa; t=1643375406; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=DmGgYXIxuiNl6v6cMRPQigMIgjtXtbGpaAKFRJYhv/I=; b=L6qKz8mphs/6Uaryogzhb4PKZ5qz9HjmJQd+AZeOj1NOq9q5tybwmX0BNHaFxsV5/DXz6 0MGNbCfUxasUG+9tMD+dPkuI8Jk+6YyvkqYg+bnKJ5g7ynn0d4IQz6bRWASZuLEvx5kNene fF6zuzmUfbqPSDrnVqLWp8KF6vK0r9yHlgH2Po92eGQPFK/ewtkz/3kXsu5goMvFClEV7Qy mDtoB3MYnR+xH7P1zYg8BQWDJ1flAwNafjNvoUx+q7k6oBniGmVuEcm2f98ca9PERRtme62 HgZYhvNQ9vue4+4h5skh1rMhkUq7ET6b0rZzg/Uur0ZxGrp9Rlz+1KSmgjdQ== Received: from zeus.lespinasse.org (zeus.lespinasse.org [IPv6:fd00::150:0]) by server.lespinasse.org (Postfix) with ESMTPS id E651116095D; Fri, 28 Jan 2022 05:10:06 -0800 (PST) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id D12602044E; Fri, 28 Jan 2022 05:10:06 -0800 (PST) From: Michel Lespinasse To: Linux-MM , linux-kernel@vger.kernel.org, Andrew Morton Cc: kernel-team@fb.com, Laurent Dufour , Jerome Glisse , Peter Zijlstra , Michal Hocko , Vlastimil Babka , Davidlohr Bueso , Matthew Wilcox , Liam Howlett , Rik van Riel , Paul McKenney , Song Liu , Suren Baghdasaryan , Minchan Kim , Joel Fernandes , David Rientjes , Axel Rasmussen , Andy Lutomirski , Michel Lespinasse Subject: [PATCH v2 06/35] mm: introduce CONFIG_SPECULATIVE_PAGE_FAULT Date: Fri, 28 Jan 2022 05:09:37 -0800 Message-Id: <20220128131006.67712-7-michel@lespinasse.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220128131006.67712-1-michel@lespinasse.org> References: <20220128131006.67712-1-michel@lespinasse.org> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 67B96C0006 X-Stat-Signature: o41s8qkjjh1mo1ct5qwpxrncznrt55dx Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=lespinasse.org header.s=srv-52-ed header.b=GDRiMZ9S; dkim=pass header.d=lespinasse.org header.s=srv-52-rsa header.b=L6qKz8mp; dmarc=pass (policy=none) header.from=lespinasse.org; spf=pass (imf10.hostedemail.com: domain of walken@lespinasse.org designates 63.205.204.226 as permitted sender) smtp.mailfrom=walken@lespinasse.org X-Rspam-User: nil X-HE-Tag: 1643375410-394822 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: This configuration variable will be used to build the code needed to handle speculative page fault. This is enabled by default on supported architectures with SMP and MMU set. The architecture support is needed since the speculative page fault handler is called from the architecture's page faulting code, and some code has to be added there to try speculative fault handling first. Signed-off-by: Michel Lespinasse --- mm/Kconfig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index 3326ee3903f3..d304fca0f293 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -894,4 +894,26 @@ config ANON_VMA_NAME source "mm/damon/Kconfig" +config ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT + def_bool n + +config SPECULATIVE_PAGE_FAULT + bool "Speculative page faults" + default y + depends on ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT && MMU && SMP + help + Try to handle user space page faults without holding the mmap lock. + + Instead of blocking writers through the use of mmap lock, + the page fault handler merely verifies, at the end of the page + fault, that no writers have been running concurrently with it. + + In high concurrency situations, the speculative fault handler + gains a throughput advantage by avoiding having to update the + mmap lock reader count. + + If the check fails due to a concurrent writer, or due to hitting + an unsupported case, the fault handler falls back to classical + processing using the mmap read lock. + endmenu