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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 DBAC4C433DB for ; Mon, 11 Jan 2021 14:01:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 670EE22473 for ; Mon, 11 Jan 2021 14:01:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 670EE22473 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 753268D002D; Mon, 11 Jan 2021 09:01:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7294A8D0020; Mon, 11 Jan 2021 09:01:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F1E98D002D; Mon, 11 Jan 2021 09:01:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 4A4ED8D0020 for ; Mon, 11 Jan 2021 09:01:57 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 093982490 for ; Mon, 11 Jan 2021 14:01:57 +0000 (UTC) X-FDA: 77693657874.10.lock83_47034ff2750d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id CFC0916A4AA for ; Mon, 11 Jan 2021 14:01:56 +0000 (UTC) X-HE-Tag: lock83_47034ff2750d X-Filterd-Recvd-Size: 4533 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 Jan 2021 14:01:55 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 1E8692242A; Mon, 11 Jan 2021 14:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610373715; bh=50IG3zR+Q9oxcbVhieDnuu5FgxkxGAFNFUX/rpImuNo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LDweBAoGyGcdo8Q8Z8bdxt61JEm0SV2DUE6HLbw752d+V76R95FuTrxT9fQycKawv Wi8hxok+e6+KdKSNX97rOM1kbhPMaY1S8+8hXQz67FyHjM5uhruT5m6yMODANNDVdY AKRFj73QUdnxLxOgBZ6V+uuJpXq51aHVTlV69KrSG/Hpur51tjxpR0DGa8CSTTQJDZ 6H4kumU/NWhGA0Ks0hbP3YN59eBuRIsWvFNH3kBqUWB01t6msUEQ+FXaO84528YDdI hs5Z8UtK23t0OmOfssqdRj8FOak+MOvmjbhHhBdK/irmCoJX7gF6TCdK8QiStch3Hq SEJ9+aHuxr5BQ== Date: Mon, 11 Jan 2021 14:01:49 +0000 From: Will Deacon To: Linus Torvalds Cc: Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , "Kirill A . Shutemov" , Vinayak Menon , Hugh Dickins , Android Kernel Team Subject: Re: [PATCH v2 0/3] Create 'old' ptes for faultaround mappings on arm64 with hardware access flag Message-ID: <20210111140149.GB7642@willie-the-truck> References: <20210108171517.5290-1-will@kernel.org> 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-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 Fri, Jan 08, 2021 at 11:42:39AM -0800, Linus Torvalds wrote: > On Fri, Jan 8, 2021 at 11:34 AM Linus Torvalds > wrote: > > > > Yeah, I think that's a side effect of "now the code really makes a lot > > more sense". Your subsequent patches 2-3 certainly are much simpler > > now > > On that note - they could be simpler still if this was just done > entirely unconditionally.. > > I'm taking your word for "it makes sense", but when you say > > On CPUs with hardware AF/DBM, initialising prefaulted PTEs as 'old' > improves vmscan behaviour and does not appear to introduce any overhead. > > in the description for patch 3, it makes me wonder how noticeable the > overhead is on the hardware that _does_ take a fault on old pte's.. > > IOW, it would be lovely to see numbers if you have any like that.. [Vinayak -- please chime in if I miss anything here, as you've posted these numbers before] The initial posting in 2016 had some numbers based on a 3.18 kernel, which didn't have support for hardware AF/DBM: https://lore.kernel.org/lkml/fdc23a2a-b42a-f0af-d403-41ea4e755084@codeaurora.org (note that "Kirill's-fix" in the last column was a quick hack and didn't make the faulting pte young) So yes, for the cases we care about in Android (where the vmscan behaviour seems to be the important thing), then this patch makes sense for non-hardware AF/DBM CPUs too. In either case, we see ~80% reduction in direct reclaim time according to mmtests [1] and double-digit percentage reductions in app launch latency (some of this is mentioned in the link above). The actual fault cost isn't especially relevant. *However...* For machines with lots of memory, the increased fault cost when hardware AF/DBM is not available may well be measurable, and I suspect it would hurt unixbench (which was the reason behind reverting this on x86 [2], although I must admit that the diagnosis wasn't particularly satisfactory [3]). We could run those numbers on arm64 but, due to the wide diversity of micro-architectures we have to deal with, I would like to keep our options open to detecting this dynamically anyway, just in case somebody builds a CPU which struggles in this area. Cheers, Will [1] https://github.com/gormanm/mmtests [2] https://lore.kernel.org/lkml/20160613125248.GA30109@black.fi.intel.com/ [3] https://lore.kernel.org/lkml/20160616151049.GM6836@dhcp22.suse.cz/