Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp722309pxf; Wed, 7 Apr 2021 09:57:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzT0hZy618iyoSA0tNXs1D8dmix7xy1KW9r1YyruEsHE3/w2PpJwDwOqQKLrgl/C5ct4YD X-Received: by 2002:a50:aad9:: with SMTP id r25mr5683792edc.125.1617814639218; Wed, 07 Apr 2021 09:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617814639; cv=none; d=google.com; s=arc-20160816; b=btxLeG2ktXspz5OR84Qi6U+Xv1cZcYzq65ifYTQd0YZ6MDWwCE+K8LKUDBiUVNjWOw MH31V4AA7+ewSp9gPjrTQzpBFc1eTY0AsQ2fQZWWLZJO6xR1bvFN2vGFcC7RsCK+k/NK WmoT1Gw41WWJvzgmYBhHIEajLeIMR3gsclcg3XQp0xA+yjangDZWP0akUEci6cTLlIXZ 7c7h7k58miflvihClgUkE35gvd7H6ajQxvorBYN3kd+4I7NQg5O4hpyWAq0qgOKQ52aj v0lMe0QlP3KUXgt52dWvcdde1qklmyEOFzh4V42aphgN8gkZIP31SfimNhkGkeZksImE vMeg== 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=7VQ5ACimMolgPW4s1A3qwSpAn4d6FTK3GCINFHzHKDI=; b=yH48zMh431NXgu2wacS4asE+QE5SE3kBPaToN+353HVvVJq9spPrUXiBiRTiZ1eUkO 1DBAGlh+TVN18fYsiW06J5bijQqPv5BoiWk1nDlu0DCf0Z5vowWb+NXAAc1Kct/KnS/6 jhx92KQ0z6hSeTVBBKOTwKut+rwT0BpVmHADzeNep81RYR8J9leuV5oX6bXLOhEdLOWw ypKZHPHV1fsYSxPJh2upn7y0yy84KZEX9eD2Gxn9NfUlENrWHWcCkLizyctWEkM+al6w M8bA7q9DH8S1943BRlHJ0zWrXtBQf9lS/oBuVp4mmvzkFStZ54Cuf8+4gp3pLJdGGsy0 rVOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.s=srv-11-ed; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b="B99SXq/P"; 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 o17si674552edv.601.2021.04.07.09.56.55; Wed, 07 Apr 2021 09:57:19 -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-11-ed; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b="B99SXq/P"; 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 S1347940AbhDGBwR (ORCPT + 99 others); Tue, 6 Apr 2021 21:52:17 -0400 Received: from server.lespinasse.org ([63.205.204.226]:45811 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347821AbhDGBvu (ORCPT ); Tue, 6 Apr 2021 21:51:50 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-11-ed; t=1617759902; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=7VQ5ACimMolgPW4s1A3qwSpAn4d6FTK3GCINFHzHKDI=; b=eoRVwI4VRjX6AijehpC7K3tU1RbT1JP295NDDl/XBGqvnKyJaXaUPR05Zgk1H6zM6EGZ1 u9NTXZPxmckNnhYCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-11-rsa; t=1617759902; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=7VQ5ACimMolgPW4s1A3qwSpAn4d6FTK3GCINFHzHKDI=; b=B99SXq/PA3x+rlEbA0HjxJukiKRbVLDPhETEfSwSgzxEn+W9W06Uf2s5k9EroMwNl4xav 7NZeXigGVzV5aRvtNC5NWBkCKJtYRKHbtiXpjNex0oEdrMrneYB7rYvSW0O2603yNKvxSRR q80ALnrADxKmUhjyzYZOpjQ8i1FyAKRlRJj1LusRsAWcyJ/YNLqE8dPdmY+f141Q57CSUX/ DsPjOqypmX+BuOBIPyXCowz87r1zD8tlu3XmF6BLwrlhnnLfDy3RSdwVl4eCnRwAEuzDFPY 0YWa70k+FHAYSd6yR44f4WEHzjhB6k+E1R6+PETGVFqYf0mGkGvOQYorrk+Q== Received: from zeus.lespinasse.org (zeus.lespinasse.org [10.0.0.150]) by server.lespinasse.org (Postfix) with ESMTPS id E2DAD160302; Tue, 6 Apr 2021 18:45:02 -0700 (PDT) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id D29FC19F321; Tue, 6 Apr 2021 18:45:02 -0700 (PDT) From: Michel Lespinasse To: Linux-MM Cc: Laurent Dufour , Peter Zijlstra , Michal Hocko , Matthew Wilcox , Rik van Riel , Paul McKenney , Andrew Morton , Suren Baghdasaryan , Joel Fernandes , Rom Lemarchand , Linux-Kernel , Michel Lespinasse Subject: [RFC PATCH 18/37] mm: enable speculative fault handling in do_numa_page() Date: Tue, 6 Apr 2021 18:44:43 -0700 Message-Id: <20210407014502.24091-19-michel@lespinasse.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210407014502.24091-1-michel@lespinasse.org> References: <20210407014502.24091-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 78cc36749754..eea72bd78d06 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3346,6 +3346,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; @@ -4342,17 +4347,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