Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp735264pxf; Wed, 7 Apr 2021 10:13:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaVd0oivNhlHG+QRrTZfVewoDRbZkWnuNPZLm9/9DzhtTmOdyd6WNL7buPk+futNYBCa7w X-Received: by 2002:a05:6638:191c:: with SMTP id p28mr4634223jal.39.1617815623906; Wed, 07 Apr 2021 10:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617815623; cv=none; d=google.com; s=arc-20160816; b=LA9573Wlvx35rsYoHxSuXC+iCpmPQ7kIhdzoFEFsSPbXoPOkwsZLo74TPvjuvDLd1j agFQD318CHgdfdFOcGju8iYPaqOaQ5G624p2pFz269K5ZLZ2/6Fx3gwtmZCIkoywFKzq 5QNkHyZBxoT4j6+Rp/b6ATKws3aIK3fBBCQ4OMsZ+ZuGS/TIdbs9962BggAsSwoEPY7m x8oLRlcH15QnYxefQPv81Nlsp8RwGtSUqzOsgM+U+ON3NK4HsRdak7ZvzjMNmh+0Ge/z Z3o4snvtrJyVyb7QWykC9nxnFhVB/Fz5Li9kqHX+DBjB0XtxnLlu/UKgsD+B3a5aDJgH K6uQ== 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=oDsaekR07u2ZtR1enj5FUb1cWHHQoW5twL22pxVnaDw=; b=CeO00DAgQ6gT22oohHikqR46jvYgPpNPGWHYjpgqZHPJ8A4H0XpcN10IGNTtD1KZdq Ag/vd0yfna2lyAGF3SyZV7S1EEJKURW2kPnjBtAk7dznSdUA/NdO6HnJICeSiINiSU6T o0EmWUF9dUGmQT1GLpz01+l4bkdL9MRpq6QtWHbmg5NTSAVLVL4HboMvvtVySNoHG7it Yizj0+QRj3nhv6PtaEKHBxA1W4grdf5A/UP0a2pEqmpVxYOMWOlsReh71PTbARXEgwB4 +n94MTmLcEdZ2u7iossUSAFLowXmCrHytvjHYnSHqfCykxj2LQTn/Ds7mOel0RNm7OYM RYLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@lespinasse.org header.s=srv-11-ed header.b=aVLbPOwu; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b=IPnOCuRQ; 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 e17si23471782iof.24.2021.04.07.10.13.31; Wed, 07 Apr 2021 10:13:43 -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 header.b=aVLbPOwu; dkim=pass (test mode) header.i=@lespinasse.org header.s=srv-11-rsa header.b=IPnOCuRQ; 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 S1347917AbhDGBwK (ORCPT + 99 others); Tue, 6 Apr 2021 21:52:10 -0400 Received: from server.lespinasse.org ([63.205.204.226]:57789 "EHLO server.lespinasse.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347795AbhDGBvu (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=oDsaekR07u2ZtR1enj5FUb1cWHHQoW5twL22pxVnaDw=; b=aVLbPOwuUGPHPf1Ujhsv2FvPJz0fLCHY7Qk5nH/FdfC6t9RP45dBC+UVkh7OEJwRA5NGO gINHLP2nA2rEEImAw== 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=oDsaekR07u2ZtR1enj5FUb1cWHHQoW5twL22pxVnaDw=; b=IPnOCuRQxi3KY+ZyKablrM9wkR6ZD4fXn+28c+kkjDkkYrkusvUcQX/piob3616D3gf62 867C15f7ac0Z7Yfe2+ANNkmYV/Cdn2iHdUIvLzrvtXTwyzroXU/F5+tdBV5gCgTsZ3DRPD+ OFCC83+W+Btw7i/N6KVbq6llm0/a8KLfAe8uAGtIzc7jsTC3lMCAcfScT/Pn6mbPtVzzzBp DIryKpr1+tOH7RwTYt56bIOomT/HwAqSgI7HR+WPaGM4BMfuzgA2XHI1YwuXQfFKmdmvBqU q1Cav343GpyKux7Qqo3LPUSsXtGPMH/GpzC+UyOiansbtZ54CG0zffUbwEcA== Received: from zeus.lespinasse.org (zeus.lespinasse.org [IPv6:fd00::150:0]) by server.lespinasse.org (Postfix) with ESMTPS id DDE761602FF; Tue, 6 Apr 2021 18:45:02 -0700 (PDT) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id CC30019F320; 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 17/37] mm: implement speculative handling in do_numa_page() Date: Tue, 6 Apr 2021 18:44:42 -0700 Message-Id: <20210407014502.24091-18-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 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 a2c5bf29f989..78cc36749754 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4181,8 +4181,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