Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2728350pxb; Mon, 31 Jan 2022 03:03:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqBazFosXq87TBXw0Ig2i4pCPWPCkaqksK3pjGO3nUZH1+63IgIYHtGEto8zS83CyNcD7P X-Received: by 2002:a17:906:3f1e:: with SMTP id c30mr16700237ejj.715.1643627032891; Mon, 31 Jan 2022 03:03:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643627032; cv=none; d=google.com; s=arc-20160816; b=eOoCsMeBacFRe64VWzeROKpLFDfbZ5Ez40n8Da/F7RaVQGLSZPU4bdJPjl6gNbduq3 slJ881t1FiTqBOUOwZK/kgz+1Hdj9rlx209gNDk4Rsm98fhCdkU0DT2EilncgVGG7/gn TWvQwCe2XqEUE65hBZykoFONJwsh4fM8a51UBnDAlFGVa2P5QiMVJx9Li1WCgqp/PctA YSio/bYzEZSYU/r1zhG9wUaBJvxobumXxupC7tOLIPaTCx9OnAs7vXHV0UKOWyZhvVeu LERteaEKja07gXxeM3Vxny9TA4gkhBMhjnFGzDrZ4+0Gn/h6BTVML4ehVkL3t2G2bw8P JSKw== 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=uHoqHiEitsG2adH6xd+AzaN4440pSdu1fLLTZyBjHdc=; b=I3ymLvvlr0vi12AefTDyg6N4Wr4i/w6vXstFdVGVlfzThKrBR4qG2clUh4lVDfDTvL B885oRH4Rxgp69ispc3fAFi3BvP2lCUImA91xIOWI6abaPQspvO7+IfT+mpZrU7RE0eQ 4kFihHXdVH0TkM1+pfIetsSktivjohbXqNqpsJyBEjbSAhH1gfstdnzRXYsVRNmsc/An fj8JqbEmfBQgFlKf19quqBcXJlDPL41//vmkYKulI+qbRRbFw0dpNsc0wqGcfZpYV7Mr F+7n9rtUSi4+Jy+CvcAGLnzKzW6WmOD02NUiFRBxQBjhFZ/huJnDZgQVvsUDdfcEMJ85 lqag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-52-rsa header.b=djUTh9Y+; 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 z26si7671373edi.339.2022.01.31.03.03.28; Mon, 31 Jan 2022 03:03:52 -0800 (PST) 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; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-52-rsa header.b=djUTh9Y+; 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 S1349007AbiA1NUr (ORCPT + 99 others); Fri, 28 Jan 2022 08:20:47 -0500 Received: from server.lespinasse.org ([63.205.204.226]:35317 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348751AbiA1NTL (ORCPT ); Fri, 28 Jan 2022 08:19:11 -0500 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=uHoqHiEitsG2adH6xd+AzaN4440pSdu1fLLTZyBjHdc=; b=1eE7s25AKDC9KWLUsK1P+gDDXQS3CKuxa6HMqYPfvCfGKLZhIojDGscSOm/Ufv9mPLMnG XKbeaxCLmPX/TWaAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-52-rsa; t=1643375407; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=uHoqHiEitsG2adH6xd+AzaN4440pSdu1fLLTZyBjHdc=; b=djUTh9Y+zDGOrV/rzW37emAErhohtTwhjN/ABtXVYGKLWtLhSR5MR8Sq5CIrnvNlX6iSC PW8YmSUJzY/Qx/HxEnw3rrkJamXcI0gSEsJJzN2rAMjvaHi/dsFb0kWQNFN+NKtX+jl7WLq x2ftK834MzhH3bnYqmlymAIGNsG3yyDZf3rDELQGZ12Eo5i2WP+HyI9hWLRiWIw2vJlbDY/ IdBO/neq4UrCqmgYFRCG4lGSEK5TesRe+kWc/XrLlQRPU48c8a6kFaA2G/LswmRFkHszUzt PZgM/bnPyhFRiSsUyqeCMP3RLoLdB59R8VcKi5feKkRFSzc6MhQxJhC5FzXA== Received: from zeus.lespinasse.org (zeus.lespinasse.org [10.0.0.150]) by server.lespinasse.org (Postfix) with ESMTPS id 21498160AA1; Fri, 28 Jan 2022 05:10:07 -0800 (PST) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id 065B82044E; Fri, 28 Jan 2022 05:10:07 -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 21/35] mm: enable speculative fault handling in do_numa_page() Date: Fri, 28 Jan 2022 05:09:52 -0800 Message-Id: <20220128131006.67712-22-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 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 083e015ff194..73b1a328b797 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3589,6 +3589,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(vmf)) goto out; @@ -4611,17 +4616,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