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, URIBL_BLOCKED,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 0131BC433DF for ; Tue, 4 Aug 2020 15:28:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BFFD12086A for ; Tue, 4 Aug 2020 15:28:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFFD12086A 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 33C1E8D0170; Tue, 4 Aug 2020 11:28:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2ED078D0081; Tue, 4 Aug 2020 11:28:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 203C28D0170; Tue, 4 Aug 2020 11:28:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 069998D0081 for ; Tue, 4 Aug 2020 11:28:01 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 73682180ACF7F for ; Tue, 4 Aug 2020 15:28:00 +0000 (UTC) X-FDA: 77113266720.19.sun32_5704faf26fa7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 7757F1ACEA2 for ; Tue, 4 Aug 2020 15:27:55 +0000 (UTC) X-HE-Tag: sun32_5704faf26fa7 X-Filterd-Recvd-Size: 2322 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Tue, 4 Aug 2020 15:27:54 +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 B307C2086A; Tue, 4 Aug 2020 15:27:52 +0000 (UTC) Date: Tue, 4 Aug 2020 16:27:50 +0100 From: Catalin Marinas To: Peter Collingbourne Cc: "Kirill A. Shutemov" , Andrew Morton , Evgenii Stepanov , Linux ARM , linux-mm@kvack.org Subject: Re: [PATCH] mm: introduce reference pages Message-ID: <20200804152749.GE31076@gaia> References: <20200731203241.50427-1-pcc@google.com> <20200803093259.ookknl4y7ee5hun7@box> <20200803120134.GD6132@gaia> 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: 7757F1ACEA2 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, Aug 03, 2020 at 05:50:32PM -0700, Peter Collingbourne wrote: > On Mon, Aug 3, 2020 at 5:01 AM Catalin Marinas wrote: > > I think this would work even for the arm64 MTE (though I haven't tried): > > use memfd_create() to get such file descriptor, mmap() it as MAP_SHARED > > to populate the initial pattern, mmap() it as MAP_PRIVATE for any > > subsequent mapping that needs to be copied-on-write. > > That would require a separate mmap() (i.e. separate VMA) for each > page, no? That sounds like it could be expensive both in terms of VMAs > and the number of mmap syscalls required (i.e. N/PAGE_SIZE). You could > decrease these costs by increasing the size of the memfd files to more > than a page, but that would also increase the amount of memory > required for the reference pages. I think I get it now. You'd like a multiple page mmap() to be covered by a single reference page. The memfd trick wouldn't give you this without multiple mmap() calls, one for each page. -- Catalin