Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp635183pxy; Fri, 30 Apr 2021 12:53:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3H1FiHPFrVcepvlgkSVFOr7x57eMvw/o+jnN+IKGxfFjhD7S8UpdxSY4xCzH/8M8kNugC X-Received: by 2002:a63:c10a:: with SMTP id w10mr5967004pgf.353.1619812424602; Fri, 30 Apr 2021 12:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619812424; cv=none; d=google.com; s=arc-20160816; b=NhEVzA9w+3pkwVDV5Je4zaaX2o1f+OghQ8nGJuZ6wVh4jb8VYdOQI5oD+soGWcZdrQ Pt0e2DZ+9qf/JxQsmI4dR1JGluWMdv0wwSWWc1rY9ujJqGQ78FyZdc9y/HaNNlH7wgZa Qw6+5W2a/UIQRwvyhnlKyA2UAOinvw2E8DaKJqgMGqyepxyh2enUh8UGCVLfJ4VS+7yC 0yzKC8oPn/9rs+FQ/v8nFe/wHeazcQNz4yGCYC7mptY5so2VNurnc8p0sDG48CMc8LcS fHCC2kOpxIfWN+G9qtzvORxqSMVtPOBCYMf/NxS6tbk+vwztrPGemayMjWrmQiGvIck0 UAkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=45X0hICb7YyLurpFubxOZ+gBL34g/MPyB7oW/aDWSiM=; b=sXZBzKWgaCj1BqRoHQ0kA1nHK7j6XM6ivq9Sxf3wWEEDBGNiLylvj2iNiKfBj8Rph7 LUdC8rto8boE4hDcOPFDrLEleoWanuNkFM1n/NZw2IlM6LtjlPfNtzcPW5i6QJS800jc Xjark9qEeHHk4VjLhJNCA6VqitHRV4OAnrYvlZd9pgdxzen0QwP8PAX37CQFxQuwu3hE dyQGLzknYPj1mm96YEclV65Kw1khOFqluIrfMmJ2mwn1VXHUDJFZOfPxJFFpLy3i5zEA Y1a9QHKX7Ml4WoPEw+mSLCewNZpc+rQ4XHwQ/Mf78Z0sv59BIV17pYFRG/kw0Zh4ZtW/ MNNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.s=srv-14-ed; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-14-rsa header.b=D3rIm98j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lespinasse.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si4430942plv.429.2021.04.30.12.53.32; Fri, 30 Apr 2021 12:53:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.s=srv-14-ed; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-14-rsa header.b=D3rIm98j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lespinasse.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233435AbhD3Txm (ORCPT + 99 others); Fri, 30 Apr 2021 15:53:42 -0400 Received: from server.lespinasse.org ([63.205.204.226]:44335 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbhD3TxX (ORCPT ); Fri, 30 Apr 2021 15:53:23 -0400 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.20.1