Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp636407pxy; Fri, 30 Apr 2021 12:55:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzybF4AKFlWZ8A16V4lOHRdhiWRrB8baGmS00h3vBALDm8QDzDQjbKlANZl2Ifl7fNqabpo X-Received: by 2002:a63:ea0b:: with SMTP id c11mr6122714pgi.120.1619812549086; Fri, 30 Apr 2021 12:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619812549; cv=none; d=google.com; s=arc-20160816; b=0O/Cd/aslM/riSLx9nfQAZofSWqbPLo2y21CrsIG1mdFFloGzi6HxQDYT5tlUKm2ah ST5jGHNnmAV8RxJUfBK+yL5vhI4HFjZB9Hu9EoXK8Y7MDYlstDjtzbu7MQ1kbiMWDma2 Nqf5c8P3upv9t3Rbvn7SZ6s399DoWEicpBmn9CbKiujYMIiJTKPtijlSa1B5eVxW05u4 63R9WLEpzIn8YQqA7/B3t0n20MSrTiWGUp7dJsgvwlkxwhPfXAbkPAZ0PP0RSygjRr01 htmnhoHlXEtckUKMWSamNyboJd8rnVRRRkd8PMLYzjxXctL8lelrNldgEQfRTFEq3Bto ALrg== 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=1L50YJ40ZUGhKi7U56okv5p4ypQrfJ9Qy1e+oZQLfEs=; b=mBYEsYjVYZjgpBQ/lRLqzSc5zvNrn1rD3qVn1/3HXgi0KpHBj09jQp/uQS24yBwqzs gBIHwwAnlwqGD2YKX+QufiyKAR0kRXc0GXBXWfMMRJFOnhwXFM+ncGO81KlIM7op5eEo bFVNyKSBYMDMcc2f2Ez485O+1Vo0VFZrFt49ysAacF2OesiwfUOfa5+cBuxHhx0+uzNZ y2tj7UIvxW0+KTctZpyQF15Q+jeWt8pJWoETDPjP6vd4Y1+pP9XLW2Hr57fhl/P/TMWP dU/M0P4m7X7t0WkCQ46zMgJEofw+DrFjYlZKGSh4OBvFn4F7xXIRBWewkuRl91alfmJ7 VAlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.s=srv-14-ed header.b=Brwwj7gJ; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-14-rsa header.b=ouNOvDWk; 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 b15si3585294pfd.331.2021.04.30.12.55.35; Fri, 30 Apr 2021 12:55:49 -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 header.b=Brwwj7gJ; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-14-rsa header.b=ouNOvDWk; 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 S233315AbhD3Tya (ORCPT + 99 others); Fri, 30 Apr 2021 15:54:30 -0400 Received: from server.lespinasse.org ([63.205.204.226]:44459 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232408AbhD3Txc (ORCPT ); Fri, 30 Apr 2021 15:53:32 -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=1L50YJ40ZUGhKi7U56okv5p4ypQrfJ9Qy1e+oZQLfEs=; b=Brwwj7gJyZRfaNkZXJQVGbs8sZpxuIJtgdHMAi1QT3YHt8Bee/ZoafHWKKtqdak76+hm7 Zkxt0jIKt4dvdwkAw== 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=1L50YJ40ZUGhKi7U56okv5p4ypQrfJ9Qy1e+oZQLfEs=; b=ouNOvDWkDxT2pSbRkmI32QMVAK9o/l9HE++tUyWfAi5lB/O0izySgxB6nzXJ+UKfpnHmx +n7kKQ2SWEHvsaTGG90ts4eyff88aM3tiLqQOmAEnz9AXk5kHBJ2L+aANfN7P/HfDqQCXL5 4hmfCw4JsNphr/TmFIYIJrnBWT5/2zMSnD84vK5AqH8mZ9S/h6EEtmt4R8x9RXkcdi2NJXY QCmVi9n1n0vvwDg6lR7ogUk7bR4uz7bSPyUCsNZz1m4dCBHBkNqRdGgmWdzK4QSNzjI/qlz XCvGtDkIE1sX7/T4etK/S4N4HWmfKfIJIocGbiT19PAprQylJxc6pSF04W7Q== Received: from zeus.lespinasse.org (zeus.lespinasse.org [IPv6:fd00::150:0]) by server.lespinasse.org (Postfix) with ESMTPS id 90A4D16033C; Fri, 30 Apr 2021 12:52:33 -0700 (PDT) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id 8343919F522; 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 20/29] mm: enable speculative fault handling in do_numa_page() Date: Fri, 30 Apr 2021 12:52:21 -0700 Message-Id: <20210430195232.30491-21-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 Change handle_pte_fault() to allow speculative fault execution to proceed through do_numa_page(). do_swap_page() does not implement speculative execution yet, so it needs to abort with VM_FAULT_RETRY in that case. Signed-off-by: Michel Lespinasse --- mm/memory.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index a2230269e034..286776b7795b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3363,6 +3363,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) vm_fault_t ret = 0; void *shadow = NULL; + if (vmf->flags & FAULT_FLAG_SPECULATIVE) { + pte_unmap(vmf->pte); + return VM_FAULT_RETRY; + } + if (!pte_unmap_same(vma->vm_mm, vmf->pmd, vmf->pte, vmf->orig_pte)) goto out; @@ -4359,17 +4364,17 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf) return do_fault(vmf); } - if (vmf->flags & FAULT_FLAG_SPECULATIVE) { - pte_unmap(vmf->pte); - return VM_FAULT_RETRY; - } - if (!pte_present(vmf->orig_pte)) return do_swap_page(vmf); if (pte_protnone(vmf->orig_pte) && vma_is_accessible(vmf->vma)) return do_numa_page(vmf); + if (vmf->flags & FAULT_FLAG_SPECULATIVE) { + pte_unmap(vmf->pte); + return VM_FAULT_RETRY; + } + vmf->ptl = pte_lockptr(vmf->vma->vm_mm, vmf->pmd); spin_lock(vmf->ptl); entry = vmf->orig_pte; -- 2.20.1