From patchwork Mon Nov 15 07:55:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12618847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A09CC433FE for ; Mon, 15 Nov 2021 07:56:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4973E6321A for ; Mon, 15 Nov 2021 07:56:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4973E6321A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E07E46B0080; Mon, 15 Nov 2021 02:56:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D91BB6B0081; Mon, 15 Nov 2021 02:56:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C324F6B0082; Mon, 15 Nov 2021 02:56:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id AF9486B0080 for ; Mon, 15 Nov 2021 02:56:04 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6975083EAE for ; Mon, 15 Nov 2021 07:56:04 +0000 (UTC) X-FDA: 78810406248.17.141C521 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 48FCAD0000BB for ; Mon, 15 Nov 2021 07:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636962963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oiRP6M0XDz2JYaGWMJAJYTL9K9of+5C/YsBL0nPA2ZA=; b=UshRouBwHf0vuWMpvkgpxgsVPpAYVGZTKqp3DWICnES7E4n4GEPSurD9K//WcZwAVcZFXC 01o41COmks00VA2wtFhYJ3lvlvs9S1N4xSArta+DmD7VBUOlDcJtQ0XM8wOo5VvVMGlaap Cm4oPUBLPCahVkxZymKUGFv5dV9y3S4= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-282-lhQhI7oKP6Cxbk61jcfr1w-1; Mon, 15 Nov 2021 02:56:02 -0500 X-MC-Unique: lhQhI7oKP6Cxbk61jcfr1w-1 Received: by mail-pg1-f200.google.com with SMTP id p20-20020a63fe14000000b002cc2a31eaf6so8765940pgh.6 for ; Sun, 14 Nov 2021 23:56:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oiRP6M0XDz2JYaGWMJAJYTL9K9of+5C/YsBL0nPA2ZA=; b=WldI0rFjcfdqecYndIRbQBt7WDQG6DrJcDpXQG8Nu67/+DofNa33ibYy10zLmvEemV IUC8ZCKVqWs4Ki4g0aITQM0ScKv6fJeWz/vMjSJHTAsfZ/YqEcS4Duw00IereIn6KeD7 mdOOMMJtMIzafOYbfO84Mc/CISIcovG7YH4tYVzvjbIhDyss2GrYH2K9BPlAWKQrQPrV miyICrKU485IJ8aRWvYPEeumcp4gUi/28IcLqFBa55iU/YVSSgt8T8RvyPFF2lBw9iOt TdaCNwGB0uRL1Ju63zv1bRPW7M6Xb5CTAI2bAKCey9XIU5WvhqTPe0vFXoC2ANjzYG96 mMBQ== X-Gm-Message-State: AOAM533pQQVVnoU2deYTGFjeu179oKTHAQd5l6qj/YRsYllQ24YWnc92 SYjSYpIhm7CON6BLOVC/7GFkC1XfK7ihpPqrF/NYfN3Oxw7afNnOs/F28XFybgifTvOZ9ZH8grr j33TWnm6/0xn6ECnrKKZbbwVnPlj4L8K3lE2RGJ46zhP5/odxsAQUafdSOUnP X-Received: by 2002:a17:90a:df97:: with SMTP id p23mr44899766pjv.3.1636962960971; Sun, 14 Nov 2021 23:56:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJw80QtT18dNY1cg9toIlmKOYG28dAqiAY105pUOfD9FUEbM6Y8GthQX1coYmOY4ZZLz+1zQRg== X-Received: by 2002:a17:90a:df97:: with SMTP id p23mr44899715pjv.3.1636962960688; Sun, 14 Nov 2021 23:56:00 -0800 (PST) Received: from localhost.localdomain ([191.101.132.223]) by smtp.gmail.com with ESMTPSA id e10sm15792796pfv.140.2021.11.14.23.55.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Nov 2021 23:56:00 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Axel Rasmussen , Nadav Amit , Mike Rapoport , Hugh Dickins , Mike Kravetz , "Kirill A . Shutemov" , Alistair Popple , Jerome Glisse , Matthew Wilcox , Andrew Morton , peterx@redhat.com, David Hildenbrand , Andrea Arcangeli Subject: [PATCH v6 03/23] mm: Check against orig_pte for finish_fault() Date: Mon, 15 Nov 2021 15:55:02 +0800 Message-Id: <20211115075522.73795-4-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211115075522.73795-1-peterx@redhat.com> References: <20211115075522.73795-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UshRouBw; spf=none (imf20.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 48FCAD0000BB X-Stat-Signature: rjsfkei468wppunzd34tdn5qw678itim X-HE-Tag: 1636962951-843775 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We used to check against none pte and in those cases orig_pte should always be none pte anyway. This change prepares us to be able to call do_fault() on !none ptes. For example, we should allow that to happen for pte marker so that we can restore information out of the pte markers. Signed-off-by: Peter Xu --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 04662b010005..d5966d9e24c3 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4052,7 +4052,7 @@ vm_fault_t finish_fault(struct vm_fault *vmf) vmf->address, &vmf->ptl); ret = 0; /* Re-check under ptl */ - if (likely(pte_none(*vmf->pte))) + if (likely(pte_same(*vmf->pte, vmf->orig_pte))) do_set_pte(vmf, page, vmf->address); else ret = VM_FAULT_NOPAGE;