Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2287592pxb; Mon, 11 Jan 2021 06:07:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJz54FmCj3cQHzOzfQLPY6rO2mcpYC4aCnBRf2KpVcppkvlV7zSDsdMuV24uszsn7UnDxef2 X-Received: by 2002:a17:906:a283:: with SMTP id i3mr10842317ejz.496.1610374051138; Mon, 11 Jan 2021 06:07:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610374051; cv=none; d=google.com; s=arc-20160816; b=DsrbPihMzns2j5tP7xgbUhafXp2gdOYKkV1bFGPbdFY0U9MZtzIaAEzfJjC9qjK+f3 83Dcl/bz0XyW7ELfNEsRvxS/y9R2EfjzFgWuZSvEJCLdQdifdqXhRnLO/qT/uqATzYWc 9qkubU/OAUltzts+iiDVoKE4aobYFeUVs4PwYaogIRHsWX6I7uDQOqC8P9OOKfi1e2us 4Jf0waPdIffaBHyOKqgXC2JNy/iA6xMlx6WbWmFgWSlWuFu8k1fDoRFSW1Y7bXemtRY7 /Ii7L7WLbbn63rAEw5yNUi/D2U7a2a1nTZD7Cac8pMW4pyw/aPm6RpfFRT7s39c+A3X8 nqbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=UlwapJhJncuQTaEOvuPpmnNt5wa6PfYwEmg/P/Vr3Iw=; b=S8uouVINXfoMSKV9JHK5uJj/XXJhVleYAdSsbz7h6sw5HVmPbF0wPUQ/RQt7C3gncx CMfvz3MAgwLcvsJ4OQTN7Vsszv8VNRlTyHRpj9bTqpOJXDBZ1OYiWmLuPQjx+WLwUUiC AD31VWqBLe0jMWmv+t4Q1sOV6vJB2T/us8wiU5WTH58WB0y1aLl2OtD4+uC6Tk7Shvyd +opzRw+EdyvlD8/15G5rIjCIMLpOFrjKK3W5amhoocKsQnJd7xH0MemL3+oKuBwAic3o rbg/RSSm9qY0E1ZrA5VABcudTKUfJk73ZYHK7rVd1eYVtd7mKpYw13GD5Dn7Ip3SC4zy HGnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LDweBAoG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w10si7314488edv.243.2021.01.11.06.07.05; Mon, 11 Jan 2021 06:07:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LDweBAoG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388328AbhAKOCl (ORCPT + 99 others); Mon, 11 Jan 2021 09:02:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:57710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388298AbhAKOCg (ORCPT ); Mon, 11 Jan 2021 09:02:36 -0500 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/