Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp635791pxy; Fri, 30 Apr 2021 12:54:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHO0Ws7Ii56uxxjtFoVnAUeK088F3eVrvDsyrvrNYdgeqeMASzUs26k8f4Wmiv5jiyk6FQ X-Received: by 2002:a17:902:c651:b029:ee:9ce7:2d74 with SMTP id s17-20020a170902c651b02900ee9ce72d74mr5176148pls.84.1619812486830; Fri, 30 Apr 2021 12:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619812486; cv=none; d=google.com; s=arc-20160816; b=P+OhnYA7foUdJt1UdaBJj8gPU75MJFJhsWIq0ugS4uvXEteIWljptVclwR/CHildpJ L5Sax6m4oYeALJ1ZLW7UGvh5ioqcCL7AggiL9B9GxoUPeANMOrQZGe2Qy+QlYsKlmU4M nFjt/Y9cHqHiVefpbL920+PhHNPTvjtfG2gpxSf75T8eZHrlKQb/KVjxuaKGdiw49OMw TkmuCqSTD7KVlG3rMmGuvZGf1rb70v8DDpS0QhPfYFOQ6ajKqVARfE5iHhrXIherTUX6 mSrpoBvZisK17584t2gqyqsnhD+0AKTbnn/RGpBLSt205jhc8NNEda+vPP41vPXWFiH5 MKgQ== 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=xyC4YWMYQXg5okBOT+I25AzHoSz3IJwuaB8/iA0p/AY=; b=kd74VvZQLlPcKShRRUcZ+OqSA2LBEQod1Ozbd/GtkTE1rWIyy4aYs6FMfyjXWt2XJI KU7OqQejde7U911+BQphfbgh3gaCVbM9ASLMqRVzADBwAbwO0twz8V1TPHhiy6BeNlKD MoIltMJxD9iW4zzBanYhF3y+mks82IPN8yfhdo2vCFl7oHsIn3CCfUlb4EaoBEjJ3ju3 MEQUO0VhuP3y6QB/3Zx5LqVhxNrlAY4Bt+BqNnTFRQL5XCehE9M4VqYZSwtQLUNHIDTf aa1SV8MWB59FjJLT/p0nXV85CpTX3SEw36LvvuXHjfm5/lAt/h5dIwN4phbtYoM94BsC ES5A== 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-14-rsa header.b=F9lBNAo3; 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 w2si4420866pgs.448.2021.04.30.12.54.34; Fri, 30 Apr 2021 12:54:46 -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; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-14-rsa header.b=F9lBNAo3; 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 S233690AbhD3Tyh (ORCPT + 99 others); Fri, 30 Apr 2021 15:54:37 -0400 Received: from server.lespinasse.org ([63.205.204.226]:37183 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232412AbhD3Txf (ORCPT ); Fri, 30 Apr 2021 15:53:35 -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=xyC4YWMYQXg5okBOT+I25AzHoSz3IJwuaB8/iA0p/AY=; b=4alexkTsyC3uZni2zW955kLIH7/cxJEXaY5kAd+KYDy1zPDGn17cBxujc6Cmd2xX8mlsi 9BjuR3Z6KRJsIohCQ== 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=xyC4YWMYQXg5okBOT+I25AzHoSz3IJwuaB8/iA0p/AY=; b=F9lBNAo30q0ql99dAFCdVKf27nzoKGBO6/YkgLB360VcrFXl9oOJn/NiXASR/OpX6yu5q AYM1MAxJgm+qsk5q1FYDKUbOplpLlwf8c6J1NbjZN/N6L+5dTdI3pxu2ZjmTK+6IVX+nuH5 LMrFAIzKe0xIJwC3UqPVQlQBLow7LKLo6lS4ULhcubgcjVWe7ZzrvfbqAW6+/ukLUWOGY/b Enp2whRD+IPVFO3yWGpb5vwaAVi84bDRLUYwoIVDyFE0wwYC//bioKbWK0vm8u+PPo6Z4uA SITn326/KMoS5eM2sILhnDcUVF5qUpYVtm71XlOCgBfBLHuQ55YAnrE5CuOA== Received: from zeus.lespinasse.org (zeus.lespinasse.org [IPv6:fd00::150:0]) by server.lespinasse.org (Postfix) with ESMTPS id 8ACF116033B; Fri, 30 Apr 2021 12:52:33 -0700 (PDT) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id 7D23219F523; 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 19/29] mm: implement speculative handling in do_numa_page() Date: Fri, 30 Apr 2021 12:52:20 -0700 Message-Id: <20210430195232.30491-20-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 do_numa_page() to use pte_spinlock() when locking the page table, so that the mmap sequence counter will be validated in the speculative case. Signed-off-by: Michel Lespinasse --- mm/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index eceb1b6e904c..a2230269e034 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4198,8 +4198,8 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) * validation through pte_unmap_same(). It's of NUMA type but * the pfn may be screwed if the read is non atomic. */ - vmf->ptl = pte_lockptr(vma->vm_mm, vmf->pmd); - spin_lock(vmf->ptl); + if (!pte_spinlock(vmf)) + return VM_FAULT_RETRY; if (unlikely(!pte_same(*vmf->pte, vmf->orig_pte))) { pte_unmap_unlock(vmf->pte, vmf->ptl); goto out; -- 2.20.1