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 01CFDCCA479 for ; Mon, 18 Jul 2022 21:27:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FCF36B0087; Mon, 18 Jul 2022 17:27:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 75CDB6B0088; Mon, 18 Jul 2022 17:27:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AE676B0089; Mon, 18 Jul 2022 17:27:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 430C16B0087 for ; Mon, 18 Jul 2022 17:27:22 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0A11020FAC for ; Mon, 18 Jul 2022 21:27:22 +0000 (UTC) X-FDA: 79701506724.16.2B7F3BF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 9F82018004E for ; Mon, 18 Jul 2022 21:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658179641; 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=iAS6PfYFM+e9fWCYEbVUCHzaBiHStTqFPNBubs/F47c=; b=Y02jTqVdlgWhSuhIqCEV4lOSKD53SLyBCQYJqia2FTBOGFBBQta6b0ZFVxdXt+BYUCm7Q0 nokmNTsYu0UrgENBQXsTRzl3+2jazWBoXEBK7n0Kg6zT2PAmjJC33eD/Oy3EerGS1zDLoU fDjoDvh9uAOyuaEqtsqqDJtZFR2uyvg= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-392-URQk1im3PmiuJfOf7hF_iQ-1; Mon, 18 Jul 2022 17:27:18 -0400 X-MC-Unique: URQk1im3PmiuJfOf7hF_iQ-1 Received: by mail-qk1-f199.google.com with SMTP id f20-20020a05620a409400b006b5fc740485so268428qko.12 for ; Mon, 18 Jul 2022 14:27:18 -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=iAS6PfYFM+e9fWCYEbVUCHzaBiHStTqFPNBubs/F47c=; b=a3B/2i2QwCcjtsK5hRGBdkW0y0mShqFINtmZm/zbdoo5AtBuiP40wu+j3TuiI/8tla r2yqKS7BngckZulP7rSIQC+b+cr6xjOn7Nbr8p46lXBmy5KqSHLA7xt12xrFFrzx7z73 /oco7Xf/cwXndQGTNx/6OQbUfeF5g6XbE1wNIRhjsqZiGWNmWv/DURmC7mkSVj3Sjcj8 VlQ8DWfED1YC3UJlwQ2s2zAtS1VemQAdoXQ2CLpHzDI0nxZjBYYvYaW++fNk6/BwwSHF OFNxR86qVbO7NT2rFkKWPiE7QnosJ6qJHILlfkgOWGZm9Mdy7UQemj9nvX/mvH5GzRKV LBqQ== X-Gm-Message-State: AJIora9oV8xYiCQZzj1R9jCPnru4wpQyN0y4Cx+J5u1AH6DltzsHe016 +pZnDJvf1BgcvrTF/wGGh9qLozH5yQjNz51Db6KwPSOVIqFAxnKMBxCJ+ApvLoPXF8Ldz+OID9g 6NxURtwqS+ss= X-Received: by 2002:a05:620a:2552:b0:6b4:8dbf:8992 with SMTP id s18-20020a05620a255200b006b48dbf8992mr18451754qko.109.1658179637743; Mon, 18 Jul 2022 14:27:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s9xAwKntWo9fm2Zj/2J1WcAV8yt2Qb4cI5Apyecc7bQO/HBW8X5OO5Ba351m1k8BkS1GyyXQ== X-Received: by 2002:a05:620a:2552:b0:6b4:8dbf:8992 with SMTP id s18-20020a05620a255200b006b48dbf8992mr18451736qko.109.1658179637523; Mon, 18 Jul 2022 14:27:17 -0700 (PDT) Received: from xz-m1.local (bras-base-aurron9127w-grc-37-74-12-30-48.dsl.bell.ca. [74.12.30.48]) by smtp.gmail.com with ESMTPSA id u5-20020a05620a430500b006b5bf5d45casm13623546qko.27.2022.07.18.14.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 14:27:16 -0700 (PDT) Date: Mon, 18 Jul 2022 17:27:15 -0400 From: Peter Xu To: Nadav Amit Cc: Linux MM , Andrew Morton , Mike Kravetz , Hugh Dickins , Axel Rasmussen , David Hildenbrand , Mike Rapoport Subject: Re: [PATCH v2 3/5] userfaultfd: introduce write-likely mode for uffd operations Message-ID: References: <20220718114748.2623-1-namit@vmware.com> <20220718114748.2623-4-namit@vmware.com> <9498662D-BE49-4EC7-8E7D-C78653EF671C@vmware.com> MIME-Version: 1.0 In-Reply-To: <9498662D-BE49-4EC7-8E7D-C78653EF671C@vmware.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-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Y02jTqVd; spf=none (imf06.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658179641; 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=iAS6PfYFM+e9fWCYEbVUCHzaBiHStTqFPNBubs/F47c=; b=g9LAyTTcrwBkVys+6xW+zZEcrZkCpHsl/6TQZzIUBfd8awW8hXVUP9bSYllCH3A2CmQzyL eSE/RP/vn4BTmOTQGXl0pLo0+QYs59QOUzowANgKRxxkW4yTi4fMAaVhdi+tCusIxE1bvv cD5vMgii6fyhKLK9vFBFzdKdWoVRMp8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658179641; a=rsa-sha256; cv=none; b=Vr5QjaMm/g4KegZDo4x3BCbJ7GbmiciqjzqjlI4cAECZh6V7uQ1BV5KUWPI+ojF4pEjuLP dMgRh9alEoa/Ff479hpUQAKRPPw0TxoyplIrQlB/6VXrWeXCs/5Ao8qa5WTxxXPFFeexnF iMYVciGEFISLA4h+GvMcliJZbI28xnY= X-Rspam-User: X-Rspamd-Queue-Id: 9F82018004E Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Y02jTqVd; spf=none (imf06.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: ya5whr3sonyjy3d3e4yyxuk6xf6oja3n X-Rspamd-Server: rspam07 X-HE-Tag: 1658179641-948867 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, Jul 18, 2022 at 08:25:46PM +0000, Nadav Amit wrote: > >> @@ -311,6 +321,7 @@ struct uffdio_continue { > >> struct uffdio_range range; > >> #define UFFDIO_CONTINUE_MODE_DONTWAKE ((__u64)1<<0) > >> #define UFFDIO_CONTINUE_MODE_ACCESS_LIKELY ((__u64)1<<1) > >> +#define UFFDIO_CONTINUE_MODE_WRITE_LIKELY ((__u64)1<<2) > >> __u64 mode; > > > > I thought you would have some reasoning on having the flag for unprotect > > (since our last discussion you mentioned it) but it seems not there.. > > > > Then, could we only keep the zeropage write hint but drop the rest? > > They're never used in this whole series besides the zeropage one, meanwhile > > I think we're still not reaching consensus on whether they'll be helpful? > > I think that I didn’t communicate clearly enough two things. First, the > access flags are used here. > > Now, you are correct that although the unprotect flag is defined here, it is > not used in this patch-set. There is a reason for that. > > It turns out that using David’s work to map a writable page can cause > undesired behaviors - the clean PTE, which we discussed, and additional TLB > shootdowns. Since it required a lot of changes to get rid of these > additional shootdowns, I put the unprotect changes in a different patch-set. > > https://lore.kernel.org/all/20220718120212.3180-1-namit@vmware.com/ > > Let me know if that answers your question. Okay, I'll read it tomorrow, thanks. Though note that IMHO we should have the fix without depending on WRITE_HINT at all. I hope that's what'll happen in the other patchset, or I can also comment there. Btw, if there's direct dependency on flags I'd rather squash the two patchsets. The thing is by sololy reading this patch the reader will have no idea why you wanted to have WRITE_HINT outside ZEROPAGE, at least to me. We could have introduced WRITE_HINT for ZEROPAGE in this patch (then IMO you can squash that part with patch 4) then leave the rest for the other patchset. -- Peter Xu