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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 C3E64C433E3 for ; Tue, 4 Aug 2020 15:49:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E5742177B for ; Tue, 4 Aug 2020 15:49:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HMArJBbT"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="t0u7E3m8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E5742177B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SuDr8i5BFDHynLie2LRFozXAMLp1m0/tvF6GV9owylY=; b=HMArJBbT+Yw5k+LfMGg9xGp7n 6PHhDGZuvcKhML6P678spwqbH12Ae8jZzGDGMOd5akvTlpIWIx1WAKDm+I8r4WwnBxiXRDY06TD8V KMme7a6oGm1/LHDjl5m/RXM60iqnCh4aLi19nBdXHOz+jvEm8DQsJKAd4GB/kswn930Y2j9J/YJ+t VHWczfCMQa9gM6kpYGioVLanjVsiPMldqEsdGl21Y/qzkRKstVsgXQQylKVLv3kd5+bVcq21F6lUE BFm7Cyt5BMEz7EL/I6ftjcWl5SBhK1/KS8M31qq8ITnYQoc9uIhUCbUwMsIw8ycUnar0Qa9SjxDyV vZ0kgyGMQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2zAZ-0001Iv-VT; Tue, 04 Aug 2020 15:48:04 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2zAW-0001Ha-I9 for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2020 15:48:01 +0000 Received: by mail-lf1-x142.google.com with SMTP id h8so22605596lfp.9 for ; Tue, 04 Aug 2020 08:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OyhP/lrKcIbBrIbm0/eoURB5uHPXj0EIRSYkEPGdp2Y=; b=t0u7E3m8avbWkJR0jZd+FOdNH+vyPaGpcMdnGh58SNi1XB60aRFlPYtAQmoSuibQhm 6VPUTc+rQXDed6SahtNwdZ0fGJlSttzDU4VqsZAh9XtQpOly11ydChFoL8afcJGpIOOF nxHyMGNNC7VCqjlm11LmpBtP+Q2nPPrEkDnR1Yyr/YT5OWrXIXlfmDvlXWkqMzE/CaC1 Z22n1xH4520r4Ikp/uQ942Ypb7yM40Kg/W5Z4/7ahCajtgyso+q1fPLt/60M1MPsq2Ia bzZN8vHjOzAxsM1XdP7MpbzhCLKwUH7BcnES6t7jnGssoGn7rh/BfYOpqqtJVSd2hr6t StOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OyhP/lrKcIbBrIbm0/eoURB5uHPXj0EIRSYkEPGdp2Y=; b=r1/tpnOTrYsVxpLBBKm6+KmVp54J9gqauZVau3HR2ipQLWl58kVH8zWYmOExvJRzw5 k0MMUpq3V89u8xhO5ecIkth8C0wax3kECKFfbdpfe4vsoeDkQVfdsrf33+WsXFUWivlO ZtATX2u7dn0nMoNT3dEeEqoS0UC8xgqnUXxxerGueIITADnRQKSpJy+bB2Yn9jG0Ewv1 Y+DT/13svvHwt8fblc2cWPh1OQC2W1EiV5tCecv0oXMuL63yKSOViZTsU2VBMyU0LasU 6Ek6AGg6pxp02DNplZFy9211OaYCcaFEyWJBSBBt94sjbbLT/QeWpoa7binev5CvnHqN zoaw== X-Gm-Message-State: AOAM530mkI0ISvRy33wHCqvFO6TaBTwcVMWdN0K6BIhfrHZ1t/hFT3v5 qk3AEYZSAs0YLHPQJZbLk4uITw== X-Google-Smtp-Source: ABdhPJx1I7JWzBjoSVASC43NXqYLAVgl65RXZwdTO3xBJxFUT5ssanZ+sZ6Wy1WkLH7qRn3m+Yj3xA== X-Received: by 2002:a19:84ce:: with SMTP id g197mr11309432lfd.73.1596556077348; Tue, 04 Aug 2020 08:47:57 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id b18sm7265064lfp.36.2020.08.04.08.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2020 08:47:56 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 4919810153B; Tue, 4 Aug 2020 18:48:04 +0300 (+03) Date: Tue, 4 Aug 2020 18:48:04 +0300 From: "Kirill A. Shutemov" To: Catalin Marinas Subject: Re: [PATCH] mm: introduce reference pages Message-ID: <20200804154804.hm5bglb7nrmzoxky@box> References: <20200731203241.50427-1-pcc@google.com> <20200803093259.ookknl4y7ee5hun7@box> <20200803120134.GD6132@gaia> <20200804152749.GE31076@gaia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200804152749.GE31076@gaia> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200804_114800_727735_6C909EF2 X-CRM114-Status: GOOD ( 21.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mm@kvack.org, Andrew Morton , Peter Collingbourne , Linux ARM , Evgenii Stepanov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 04, 2020 at 04:27:50PM +0100, Catalin Marinas wrote: > 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. That's why I suggested a special file descriptor that would give the same page on any access. We can piggy back on memfd infrastrucure or create a new interface. -- Kirill A. Shutemov _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel