From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 733EBC433E1 for ; Mon, 27 Jul 2020 18:42:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3FB2E2078E for ; Mon, 27 Jul 2020 18:42:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FB2E2078E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C0DD66B0003; Mon, 27 Jul 2020 14:42:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBE5A6B0005; Mon, 27 Jul 2020 14:42:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A85456B0006; Mon, 27 Jul 2020 14:42:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id 8EC226B0003 for ; Mon, 27 Jul 2020 14:42:46 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 291D7180AD801 for ; Mon, 27 Jul 2020 18:42:46 +0000 (UTC) X-FDA: 77084727132.17.pig03_470ced126f63 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id F0496180D0181 for ; Mon, 27 Jul 2020 18:42:45 +0000 (UTC) X-HE-Tag: pig03_470ced126f63 X-Filterd-Recvd-Size: 3036 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Mon, 27 Jul 2020 18:42:45 +0000 (UTC) Received: from gaia (unknown [95.146.230.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 62BB62075A; Mon, 27 Jul 2020 18:42:42 +0000 (UTC) Date: Mon, 27 Jul 2020 19:42:39 +0100 From: Catalin Marinas To: Linus Torvalds Cc: Yang Shi , Andrew Morton , Johannes Weiner , Hillf Danton , Hugh Dickins , Josef Bacik , "Kirill A . Shutemov" , Linux-MM , mm-commits@vger.kernel.org, Will Deacon , Matthew Wilcox , Yu Xu Subject: Re: [patch 01/15] mm/memory.c: avoid access flag update TLB flush for retried page fault Message-ID: <20200727184239.GA21230@gaia> References: <20200723211432.b31831a0df3bc2cbdae31b40@linux-foundation.org> <20200724041508.QlTbrHnfh%akpm@linux-foundation.org> <7de20d4a-f86c-8e1f-b238-65f02b560325@linux.alibaba.com> <45015c63-e719-a58a-7d07-6c156273a890@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: F0496180D0181 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: On Mon, Jul 27, 2020 at 11:04:55AM -0700, Linus Torvalds wrote: > On Mon, Jul 27, 2020 at 10:52 AM Yang Shi wrote: > > It looks normal page is skipped too unless it is a write fault. The > > comment might be a little bit misleading. > > No the comment is fine - in that it matches the code. > > It's the code _and_ the comment that I find to be garbage. > > > Read fault should just change young bit and typically TLB won't get > > flushed if just young bit is changed and TLB flush can be deferred again > > to write fault which may change access permission and/or dirty bit. > > This is the part I disagree with. > > A read fault could easily cause the exact same issue, exactly because > people do young bits in software too. At least on arm64 (and arm32), old ptes are not cached in the TLB, so there is no need to flush if the only action was to make the pte young from old. However, this may not be the same on other architectures. Also not sure about races with making a pte old then young again, some CPU could get confused. -- Catalin