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.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 CD9D1C433E0 for ; Thu, 21 Jan 2021 19:12:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F71823A58 for ; Thu, 21 Jan 2021 19:12:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F71823A58 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6363B6B0006; Thu, 21 Jan 2021 14:12:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BFA56B0007; Thu, 21 Jan 2021 14:12:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 460E86B0008; Thu, 21 Jan 2021 14:12:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 312846B0006 for ; Thu, 21 Jan 2021 14:12:51 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E977012C8 for ; Thu, 21 Jan 2021 19:12:50 +0000 (UTC) X-FDA: 77730729300.16.beam45_470460127565 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id B887F100E6912 for ; Thu, 21 Jan 2021 19:12:50 +0000 (UTC) X-HE-Tag: beam45_470460127565 X-Filterd-Recvd-Size: 5649 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 Jan 2021 19:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611256369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OPl8jorAsGAxXf0P/mQDZPfRGxFOXLofHdgCnNwVIcc=; b=TV0L21je/132C95rmqCcEnFdo0keqa9EZ8PD7kSzD/s6I3fO4etZDnUjJUT5xXWO2lfsIX f7ENGdKeUAB65DSRgIgu9vau7QOzqe2ZXgPlk4tU8KGZXSg86SZKpWkc0DrENr/Ea902y7 dm6mLQ6PhAlkQcf5OCfQviKvzSIw8a4= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-Os-k_FJWP_2yeogUIpHn5Q-1; Thu, 21 Jan 2021 14:12:45 -0500 X-MC-Unique: Os-k_FJWP_2yeogUIpHn5Q-1 Received: by mail-qt1-f197.google.com with SMTP id b24so2105194qtt.22 for ; Thu, 21 Jan 2021 11:12:45 -0800 (PST) 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=OPl8jorAsGAxXf0P/mQDZPfRGxFOXLofHdgCnNwVIcc=; b=DnX9vSYPFsi/7ynP8uFzeWUVzuntyKue4tpFAxAOGzrvkcNg5uSZiL6Gjc2kh+dILy Fo17lch5ELgJxSc8CxpQt3BTJnqQ0030E7Y54MSNZQwYuV9v/j+Z4+HaQ0t+Ze4/Yhu5 z/+RkouEWgPZwPBdAdNl2knMZmXl62h4eyrb/fUXAJAPcoFs7Pu25y8zti8R0ZQmque2 ZEe/M189aCQPmOPLLoyBsx5G9anyyF1+1IrGokwrLjKPqFVDCU9MrBH30sWJ7blGGbnI lXc90X7Gp4bNE/UeVTklVthjIsZniA1gsyw9PFutJsryxvdQC1K/WIlFB1H0L7i3Yyiw EA7A== X-Gm-Message-State: AOAM533B9hsA4gLtxpH70X9NnJbhef5PVCaGUyhL1dtihcn4uL3FO5KV E4X4+gm+8o5COSTlz/gZqvsZzvGJU1aZuUG1lbV/KLLImjkgriWQyNgI6pn6M3t6EEOOAy/rJIR eUm2E9hW/y7w= X-Received: by 2002:a05:620a:1370:: with SMTP id d16mr1350908qkl.26.1611256365115; Thu, 21 Jan 2021 11:12:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjih88mfXgX9Vd3gMH5PELft+ec29CkvSN6ax9zZG54+dCmmfWryq5S5QgIKBD44NV5o5pUw== X-Received: by 2002:a05:620a:1370:: with SMTP id d16mr1350868qkl.26.1611256364928; Thu, 21 Jan 2021 11:12:44 -0800 (PST) Received: from xz-x1 ([142.126.83.202]) by smtp.gmail.com with ESMTPSA id b78sm4408055qkg.29.2021.01.21.11.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 11:12:44 -0800 (PST) Date: Thu, 21 Jan 2021 14:12:41 -0500 From: Peter Xu To: Axel Rasmussen Cc: Alexander Viro , Alexey Dobriyan , Andrea Arcangeli , Andrew Morton , Anshuman Khandual , Catalin Marinas , Chinwen Chang , Huang Ying , Ingo Molnar , Jann Horn , Jerome Glisse , Lokesh Gidra , "Matthew Wilcox (Oracle)" , Michael Ellerman , Michal =?utf-8?Q?Koutn=C3=BD?= , Michel Lespinasse , Mike Kravetz , Mike Rapoport , Nicholas Piggin , Shaohua Li , Shawn Anastasio , Steven Rostedt , Steven Price , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Adam Ruprecht , Cannon Matthews , "Dr . David Alan Gilbert" , David Rientjes , Oliver Upton Subject: Re: [PATCH 0/9] userfaultfd: add minor fault handling Message-ID: <20210121191241.GG260413@xz-x1> References: <20210115190451.3135416-1-axelrasmussen@google.com> MIME-Version: 1.0 In-Reply-To: <20210115190451.3135416-1-axelrasmussen@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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 15, 2021 at 11:04:42AM -0800, Axel Rasmussen wrote: > UFFDIO_COPY and UFFDIO_ZEROPAGE cannot be used to resolve minor faults. Without > modifications, the existing codepath assumes a new page needs to be allocated. > This is okay, since userspace must have a second non-UFFD-registered mapping > anyway, thus there isn't much reason to want to use these in any case (just > memcpy or memset or similar). > > - If UFFDIO_COPY is used on a minor fault, -EEXIST is returned. When minor fault the dst VM will report to src with the address. The src could checkup whether dst contains the latest data on that (pmd) page and either: - it's latest, then tells dst, dst does UFFDIO_CONTINUE - it's not latest, then tells dst (probably along with the page data? if hugetlbfs doesn't support double map, we'd need to batch all the dirty small pages in one shot), dst does whatever to replace the page Then, I'm thinking what would be the way to replace an old page.. is that one FALLOC_FL_PUNCH_HOLE plus one UFFDIO_COPY at last? Thanks, -- Peter Xu