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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EB5FC43334 for ; Tue, 21 Jun 2022 18:43:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 51BDD6B008A; Tue, 21 Jun 2022 14:43:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CB966B008C; Tue, 21 Jun 2022 14:43:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 36D5A8E0014; Tue, 21 Jun 2022 14:43:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 233166B008A for ; Tue, 21 Jun 2022 14:43:07 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id F27971204B7 for ; Tue, 21 Jun 2022 18:43:06 +0000 (UTC) X-FDA: 79603115172.05.67BF6E7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf31.hostedemail.com (Postfix) with ESMTP id 4D894200B9 for ; Tue, 21 Jun 2022 18:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655836985; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EMmkp3DasGbYmQn9wJYifSYoCwZQyWaiW6TRmyujgVo=; b=QnFA5Q4Af2SZ9BWCRXZrrciag5XHWPOD4xxLZvCZf4lA1HKdA2eLg6yE2sQrOtf45BLQ+B 2M6AQELjufk5o5A7a+4amrwWvYoolR6eeYGV9ROlRonMYKho5Ca5A9xOHiySFNtr54fLee xNW17iytgeYkVLlTbxl2TdhLXclbkPo= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-417-Bn87zpzeP1yTKiXr9-qZKQ-1; Tue, 21 Jun 2022 14:43:05 -0400 X-MC-Unique: Bn87zpzeP1yTKiXr9-qZKQ-1 Received: by mail-il1-f198.google.com with SMTP id i2-20020a056e021d0200b002d8ff49e7c4so5619333ila.8 for ; Tue, 21 Jun 2022 11:43:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=EMmkp3DasGbYmQn9wJYifSYoCwZQyWaiW6TRmyujgVo=; b=a3+OERv9WEKQEMY5oKRJaFdYNti75DnmxVzheGvz6sGD133bXM2mn11yhD4q8GnxLn VFYBRWpf6qtnM2L2+qnK3tY1Zzaw5JcV2TgpixrtD4UWIMcuWN1lrXGj5Ao3kwFql4ln eUOw2FivdHyJ6Oyjeyl/m0pfmDBoVy8CVTnSfcTvlMX48a0g2cv5j5BcKCEynqD8BkCc Xyxyw40GiPVSX1eZbIw/haWomBvP7FE+ZWS6nUuVsAmImJgjy5nbkJ3OiYIdJDeSIOSs bfCz27/HC069rRyUB9oH+8Ahfx2/TpejO1yp5WhE49lkU2D2IOM0r5+Mim5pccFZn0li ePAw== X-Gm-Message-State: AJIora8BfWGrmKldOf3mZhoJy2XlaVJqIsJwtFOHe1opLVVdUivUz9rr /62KnaKaYNDAXUXiGM/gIpd9TWcSUnUfShp5pC1mbIgvyokAGlo/JrL1KVHG+jNf/5ZyVbZ54kH +LB6KHSSTGiA= X-Received: by 2002:a05:6602:1653:b0:669:e89d:58c with SMTP id y19-20020a056602165300b00669e89d058cmr15412609iow.51.1655836983800; Tue, 21 Jun 2022 11:43:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u+ypDlgaFacS281T2KAT3xNImpJhR0nhIYCRpbduatprDrqseQpb6tt+0HCi4vMZkSDIp/mw== X-Received: by 2002:a05:6602:1653:b0:669:e89d:58c with SMTP id y19-20020a056602165300b00669e89d058cmr15412592iow.51.1655836983584; Tue, 21 Jun 2022 11:43:03 -0700 (PDT) Received: from xz-m1.local (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id f20-20020a02a814000000b0032e7bd2287asm7518237jaj.94.2022.06.21.11.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 11:43:02 -0700 (PDT) Date: Tue, 21 Jun 2022 14:43:01 -0400 From: Peter Xu To: Nadav Amit Cc: Linux MM , Mike Kravetz , Hugh Dickins , Andrew Morton , Axel Rasmussen , David Hildenbrand , Mike Rapoport Subject: Re: [RFC PATCH v2 3/5] userfaultfd: introduce write-likely mode for copy/wp operations Message-ID: References: <20220619233449.181323-1-namit@vmware.com> <20220619233449.181323-4-namit@vmware.com> <58E53A1D-466C-4A2B-8E10-2993EFF60856@gmail.com> MIME-Version: 1.0 In-Reply-To: <58E53A1D-466C-4A2B-8E10-2993EFF60856@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655836986; a=rsa-sha256; cv=none; b=JJJQ6ExzE8n62TUOVYrlvssMCme/lkRJ66CY1lFmdr1vDC4HNZKvA/guxgkI0gwbzNtWUU v7u3R0HXjJAldnnaL5WrmDmkd/5x8bFN/HBpEGkZW4SdM2hYyQYIwfCb5WeP66AV7n9Xsk AWGME0kWkqHsQKPs/yYJFcjXUzpBqVA= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QnFA5Q4A; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf31.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655836986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=EMmkp3DasGbYmQn9wJYifSYoCwZQyWaiW6TRmyujgVo=; b=ZnBfaHKVgSl9RGAboK85vnhvN6aANuvSSAFihT2kSVO3+rwLVJKE5SizJVSMpMZ96X0JfR R2tRYuAgvdr/l6MNuMpuU3cYi4W1Jz9j4Z2tVipTNVETeECdFmSg7s+Es4PKBAMGcXxJLl uDsUm8rHqraI3vX6jvZjGJeKGxIOEKk= Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QnFA5Q4A; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf31.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-Rspam-User: X-Stat-Signature: em4scc5bhioyfit36xjio7gkxdoz4fjp X-Rspamd-Queue-Id: 4D894200B9 X-Rspamd-Server: rspam08 X-HE-Tag: 1655836986-194040 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 Tue, Jun 21, 2022 at 11:30:52AM -0700, Nadav Amit wrote: > > Only if you agree with what I thought, thanks. And that could be a > > separate patch for sure out of this one even if to come. > > I do agree. I did not quite understand your second sentence. I guess you > meant not to combine it into this patchset (or at least that’s what I > thought and I attribute it to you). Feel free to not attribute anything to me, even no need on a suggested-by. But if you plan to post for sure I'd be glad if you copy me, I may be very willing to either provide a r-b or read about what's missed there on the thought if that isn't work like that. So the only purpose of the 2nd sentense is to make sure it shouldn't block your current series (you explained why you're hurry and catching time), and that's all I wanted to express. > > >> > >> > >> I think that perhaps I did not communicate well enough the reason it makes > >> sense to set the dirty-bit. > >> > >> Setting the access-bit and dirty-bit takes quite some time. So regardless of > >> whether you set the PageDirty, if you didn’t see access-bit and dirty-bit > >> and later you access the page - you are going to pay ~550 cycles for > >> nothing. > >> > >> For reference: https://marc.info/?l=linux-kernel&m=146582237922378&w=2 > >> > >> If you want me to allow userspace to provide a hint, let me know. > > > > You did communicate well, so probably it's me that didn't. :) > > > > Yes I think it'll be nicer to allow userspace provide the same hint for > > UFFDIO_CONTINUE, the reason as I explained in the other thread on the young > > bit (or say ACCESS_LIKELY), that UFFDIO_CONTINUE can (at least in my > > current qemu impl [1]) proactively be used to install pgtables even if > > they're code pages and they may not be accessed in the near future. So > > IMHO we should treat UFFDIO_CONTINUE the same as UFFDIO_COPY, IMHO, from > > this point of view. > > > > There's just still some differences on young/dirty here so I'm not sure > > whether the idea applies to both, but I think at least it applies to young > > bit (ACCESS_LIKELY). > > > > [1] https://github.com/xzpeter/qemu/commit/b7758ad55af42b5364796362e96f4a06b51d9582 > > We have a saying in Hebrew: “When you explain slowly, I understand quickly”. > Thanks for explaining. I will add hints for UFFDIO_CONTINUE as well. I'm always happy to learn these interesting idioms, and I'm glad we seem to be on the same page now. Thanks! -- Peter Xu