From patchwork Fri Apr 30 19:52:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 12234185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 195F6C433ED for ; Fri, 30 Apr 2021 19:53:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BB06861476 for ; Fri, 30 Apr 2021 19:53:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB06861476 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=lespinasse.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 95CD46B0081; Fri, 30 Apr 2021 15:52:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 33D466B0074; Fri, 30 Apr 2021 15:52:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9077D6B009C; Fri, 30 Apr 2021 15:52:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0251.hostedemail.com [216.40.44.251]) by kanga.kvack.org (Postfix) with ESMTP id 415CA6B0080 for ; Fri, 30 Apr 2021 15:52:37 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 030314FFA for ; Fri, 30 Apr 2021 19:52:37 +0000 (UTC) X-FDA: 78090080754.38.38E36A2 Received: from server.lespinasse.org (server.lespinasse.org [63.205.204.226]) by imf27.hostedemail.com (Postfix) with ESMTP id 8BBFC80192ED for ; Fri, 30 Apr 2021 19:52:11 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-14-ed; t=1619812353; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=45X0hICb7YyLurpFubxOZ+gBL34g/MPyB7oW/aDWSiM=; b=5gnptII9qFi2vooFljqITSE4K6KmNZmsZmUPuqA2aMK3ARQMebMw8B1ZPqFQY3ds9B1t2 IhTIiOxATX/AphyDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-14-rsa; t=1619812353; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=45X0hICb7YyLurpFubxOZ+gBL34g/MPyB7oW/aDWSiM=; b=D3rIm98jspzMJBMzKScap9IiDti8fm4LvQR4SgfW7kvabLrgbhZrxbLJrAf5SMZcI3Sj5 JNgjQhZfRHtA0ssRxK4rqcWQqNQYno/lv3EYRtp4IjbDAWCX6wkDXnYC+bQjKEzp4gTRRYn gfD/+gjMyeFu0OVJDY869fxTD7GebVa0YSAMoNtkKvifQ3Ero2ezc1mpuaBFMtJFzOYphYB G55SHqK9BMFKChPa/vhHCUs4RDHIs8uYd5tb4C88OxVErkXSgXU/aaSCE164Ky+YjPxltnc ey6wXUJ0vLUoy/ord59B2CZdz19w9q7g5Dci3Vyz1SaF8tlLzZ/hBvu3xwrg== Received: from zeus.lespinasse.org (zeus.lespinasse.org [10.0.0.150]) by server.lespinasse.org (Postfix) with ESMTPS id 2F30F160310; Fri, 30 Apr 2021 12:52:33 -0700 (PDT) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id 2107F19F523; Fri, 30 Apr 2021 12:52:33 -0700 (PDT) From: Michel Lespinasse To: Linux-MM , Linux-Kernel Cc: Laurent Dufour , Peter Zijlstra , Michal Hocko , Matthew Wilcox , Rik van Riel , Paul McKenney , Andrew Morton , Suren Baghdasaryan , Joel Fernandes , Andy Lutomirski , Michel Lespinasse Subject: [PATCH 06/29] mm: introduce CONFIG_SPECULATIVE_PAGE_FAULT Date: Fri, 30 Apr 2021 12:52:07 -0700 Message-Id: <20210430195232.30491-7-michel@lespinasse.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210430195232.30491-1-michel@lespinasse.org> References: <20210430195232.30491-1-michel@lespinasse.org> MIME-Version: 1.0 X-Stat-Signature: h5af6si4k9gsyiiafjrce3f91werag75 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8BBFC80192ED Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=lespinasse.org header.s=srv-14-ed header.b=5gnptII9; dkim=pass header.d=lespinasse.org header.s=srv-14-rsa header.b=D3rIm98j; spf=pass (imf27.hostedemail.com: domain of walken@lespinasse.org designates 63.205.204.226 as permitted sender) smtp.mailfrom=walken@lespinasse.org; dmarc=pass (policy=none) header.from=lespinasse.org Received-SPF: none (lespinasse.org>: No applicable sender policy available) receiver=imf27; identity=mailfrom; envelope-from=""; helo=server.lespinasse.org; client-ip=63.205.204.226 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1619812331-453097 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 24c045b24b95..322bda319dea 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -872,4 +872,26 @@ config MAPPING_DIRTY_HELPERS config KMAP_LOCAL bool +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