From patchwork Fri Nov 20 14:35:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 11920417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF14EC56201 for ; Fri, 20 Nov 2020 14:36:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6A52622253 for ; Fri, 20 Nov 2020 14:36:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="afgeTZc4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A52622253 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1291F6B0080; Fri, 20 Nov 2020 09:36:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0AE326B0081; Fri, 20 Nov 2020 09:36:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB9896B0082; Fri, 20 Nov 2020 09:36:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id A44936B0080 for ; Fri, 20 Nov 2020 09:36:21 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1D149180AD81A for ; Fri, 20 Nov 2020 14:36:21 +0000 (UTC) X-FDA: 77505046962.02.lead60_060a1512734c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 042F810097AA2 for ; Fri, 20 Nov 2020 14:36:20 +0000 (UTC) X-HE-Tag: lead60_060a1512734c X-Filterd-Recvd-Size: 2744 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Nov 2020 14:36:20 +0000 (UTC) Received: from localhost.localdomain (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7948B2224C; Fri, 20 Nov 2020 14:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605882979; bh=Cx43nH7+0p7dCMlh2hWC5+4DOrQsHy/9+cM/6j7sA0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=afgeTZc4tCjR0MOdMgoK69uQiEsqDnC9K0pzMB5Sj80IghTT6RiSH0yixLei86pAh eA3sUhCiS98J5br6nm+aCIY5W8YWvOl3cFeDFnuwN33agaWXZXHtRo46DvLXqEmIYl oudAEy1bh7kfEsjFKdgb8jP7qkR0efezAG0Z/UKY= From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , Catalin Marinas , Yu Zhao , Minchan Kim , Peter Zijlstra , Linus Torvalds , Anshuman Khandual , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/6] mm: proc: Avoid fullmm flush for young/dirty bit toggling Date: Fri, 20 Nov 2020 14:35:57 +0000 Message-Id: <20201120143557.6715-7-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201120143557.6715-1-will@kernel.org> References: <20201120143557.6715-1-will@kernel.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000368, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: clear_refs_write() uses the 'fullmm' API for invalidating TLBs after updating the page-tables for the current mm. However, since the mm is not being freed, this can result in stale TLB entries on architectures which elide 'fullmm' invalidation. Ensure that TLB invalidation is performed after updating soft-dirty entries via clear_refs_write() by using the non-fullmm API to MMU gather. Signed-off-by: Will Deacon --- fs/proc/task_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index a76d339b5754..316af047f1aa 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1238,7 +1238,7 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, count = -EINTR; goto out_mm; } - tlb_gather_mmu_fullmm(&tlb, mm); + tlb_gather_mmu(&tlb, mm, 0, TASK_SIZE); if (type == CLEAR_REFS_SOFT_DIRTY) { for (vma = mm->mmap; vma; vma = vma->vm_next) { if (!(vma->vm_flags & VM_SOFTDIRTY))