Message ID | 20230511132113.80196-4-ryan.roberts@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4377327vqo; Thu, 11 May 2023 06:36:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nGr64ngnwmB/eAKHC8MGJybfPL/gv0FS7OzWvlH9vaowAJFKJDRO91GDYQ38dMANnYo+W X-Received: by 2002:a05:6a20:7d81:b0:104:3f3a:c973 with SMTP id v1-20020a056a207d8100b001043f3ac973mr70190pzj.7.1683812206155; Thu, 11 May 2023 06:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683812206; cv=none; d=google.com; s=arc-20160816; b=UlZQyLaMb5U6kWTzPJzJo3rdkPabijNcTVUoWddDd/Kr9zHoMVk+7vKGoc/0SVI1MT eErksdB9XlORUnr6ptd/0/pywq0G0aY9hGDluG/zsjsSwPdepuhpQvfz+XWj9CqHVxQv jJamfd5ptk46kJok1Z05JfjqP6J8t/4ubZQP7KzZz80q6fXelrG93C7poYb8B5gnG3gT l8zU83qxRPzdEmLo90nBZguYMuYBwEJS0dfWF9+5W5o7CU6xqTd5mRtGT9Wss+9JZpzy MdMI11WNSDiIY7P92LKN/SUfyCe745iduoNLpaxG6/2GSIWHwB9AlxC1OoSH8a+7qYKx 3rRA== 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; bh=lzgZOEGznLZwXHG2uMOWyrmtdrzDY9bWWF3EWrJ2RNM=; b=bAoChUPNM+dG5gFXivTReWrbT8tP69JK/+f+j5b+GcHLZjsF0uXcXic45qAif0U6W5 tb8UtPeJ5Oz9zKvKGL6rpn8YXzqI79Nqq9SSCkou3xcMOmbmQr3WgXupc8rcKH9Ffo0L DmvzDZ14RrU6Ak6bMLb91/JJFQUhaQ0Y4almdD09yXGlZAPs7CQU0lHoOdNhdw6x6hIW JAjhRxNWT0qw9QwgvLzwrSF++i1o0tK4mpTqrWviJaO/XFU8ekeRi3sp6LwQ5g9BOQWT Ji0GSiOSt9J+7DtSFPi4jtVvHdWH2KIQ5fA8BjX9a2kN3IbOVJbXv6j4TmQ7kh9eGQHN w9FQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o18-20020a637312000000b0051398fca164si1384296pgc.833.2023.05.11.06.36.33; Thu, 11 May 2023 06:36:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238161AbjEKNXp (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Thu, 11 May 2023 09:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238154AbjEKNXT (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 11 May 2023 09:23:19 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB1221157C for <linux-kernel@vger.kernel.org>; Thu, 11 May 2023 06:21:41 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5EF9C1684; Thu, 11 May 2023 06:22:11 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B85EA3F5A1; Thu, 11 May 2023 06:21:25 -0700 (PDT) From: Ryan Roberts <ryan.roberts@arm.com> To: Andrew Morton <akpm@linux-foundation.org>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, SeongJae Park <sj@kernel.org> Cc: Ryan Roberts <ryan.roberts@arm.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, damon@lists.linux.dev Subject: [RESEND PATCH v1 3/5] mm: Fix failure to unmap pte on highmem systems Date: Thu, 11 May 2023 14:21:11 +0100 Message-Id: <20230511132113.80196-4-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230511132113.80196-1-ryan.roberts@arm.com> References: <20230511132113.80196-1-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765605068023955764?= X-GMAIL-MSGID: =?utf-8?q?1765605068023955764?= |
Series |
Encapsulate PTE contents from non-arch code
|
|
Commit Message
Ryan Roberts
May 11, 2023, 1:21 p.m. UTC
The loser of a race to service a pte for a device private entry in the
swap path previously unlocked the ptl, but failed to unmap the pte. This
only affects highmem systems since unmapping a pte is a noop on
non-highmem systems.
Fixes: 16ce101db85d ("mm/memory.c: fix race when faulting a device private page")
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
---
mm/memory.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--
2.25.1
Comments
On 11 May 2023, at 9:21, Ryan Roberts wrote: > The loser of a race to service a pte for a device private entry in the > swap path previously unlocked the ptl, but failed to unmap the pte. This > only affects highmem systems since unmapping a pte is a noop on > non-highmem systems. > > Fixes: 16ce101db85d ("mm/memory.c: fix race when faulting a device private page") > Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> > --- > mm/memory.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) LGTM. Reviewed-by: Zi Yan <ziy@nvidia.com> -- Best Regards, Yan, Zi
diff --git a/mm/memory.c b/mm/memory.c index f69fbc251198..ed429e20a1bb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3728,10 +3728,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) vmf->page = pfn_swap_entry_to_page(entry); vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl); - if (unlikely(!pte_same(*vmf->pte, vmf->orig_pte))) { - spin_unlock(vmf->ptl); - goto out; - } + if (unlikely(!pte_same(*vmf->pte, vmf->orig_pte))) + goto unlock; /* * Get a page reference while we know the page can't be