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 4E52BC43334 for ; Tue, 21 Jun 2022 15:43:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB2E66B0074; Tue, 21 Jun 2022 11:43:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D61FD6B0075; Tue, 21 Jun 2022 11:43:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C29B28E0001; Tue, 21 Jun 2022 11:43:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A33896B0074 for ; Tue, 21 Jun 2022 11:43:04 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 43026211C0 for ; Tue, 21 Jun 2022 15:43:04 +0000 (UTC) X-FDA: 79602661488.14.26CA3A0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 2D761200AF for ; Tue, 21 Jun 2022 15:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655826181; 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=hRM/IPyK/hIppcpaCKXaGCHfiHq2WMovtiAVHxMZd9s=; b=d4IvGiYophTT+7/8mGZOV23UbRrzq5GQo4LNw2BVMBxmNbI9Z+0LKL/5r37UUZx0dbdceQ AcJH8Ts/6WNqLEpDQZlFuLRQbX/sgW1081n4XYnipxmlEhOVQieX5xOCsdezFn5Wx6YS9/ D2K4mGyObU06Oi1820oENZRCA1aWmWE= Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-644-Rx2kN8LLPJ6wfZywdALTtg-1; Tue, 21 Jun 2022 11:43:00 -0400 X-MC-Unique: Rx2kN8LLPJ6wfZywdALTtg-1 Received: by mail-il1-f200.google.com with SMTP id i8-20020a056e020d8800b002d931252904so938570ilj.23 for ; Tue, 21 Jun 2022 08:43:00 -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:in-reply-to; bh=hRM/IPyK/hIppcpaCKXaGCHfiHq2WMovtiAVHxMZd9s=; b=GW0Qqie3AgHH9FQV6wPcvY0C43SmFIdpgj/QvSnagJnJPX2AL7DQJqSUX5aO8gII61 9hIwvGrekFNDRVApw/53uZ7InoFoBJsGy/rGFLFEuLfrjqUrIh4xjbtmidIrxnTIp8bt 6dvaalxTPda9Ki2hxDdE+YHpfwDSOZ1EmbtZmBsyk0clbSLUyguL2v8gtURjY9A6G9rx YE0zJnOVIKtDR9GQ5Edg2f/+gxIfVGQzzdU8Tut9eCG209FIHBNw/ISy+jsnUi0FNan8 ZWynnmXpiecdTUIiEvFyiSLaZ3ALdc2CgWgAzhkmqZimQUcqYGFBobPKlB3suXjK//9w B/tA== X-Gm-Message-State: AJIora8TqZuGKt/hRtOG5ymeNvAToJAK0pmXx6zp4cmwdMGXvHAzDiLf 2Hdfpm8WtxfIdRyvUjj8P0aJoQt/vn8W3SVO2T+uP6VWRqLZbR6gDGwGmi7TAoorMFYPG3Zv1C/ Ogz5hKQVLlXI= X-Received: by 2002:a05:6638:263:b0:339:c8c1:b7f9 with SMTP id x3-20020a056638026300b00339c8c1b7f9mr2494441jaq.247.1655826179685; Tue, 21 Jun 2022 08:42:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vhSdILZqt7Z7wuJIwiRat3luY29gx+p/0RxgIxx4IZJtTKI3MVKcVlfD5m197Lyn/jmeDGvA== X-Received: by 2002:a05:6638:263:b0:339:c8c1:b7f9 with SMTP id x3-20020a056638026300b00339c8c1b7f9mr2494417jaq.247.1655826179488; Tue, 21 Jun 2022 08:42:59 -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 s17-20020a02ad11000000b0032e36d3843fsm7340951jan.19.2022.06.21.08.42.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 08:42:58 -0700 (PDT) Date: Tue, 21 Jun 2022 11:42:57 -0400 From: Peter Xu To: David Hildenbrand Cc: Nadav Amit , linux-mm@kvack.org, Nadav Amit , Mike Kravetz , Hugh Dickins , Andrew Morton , Axel Rasmussen , Mike Rapoport Subject: Re: [RFC PATCH v2 2/5] userfaultfd: introduce access-likely mode for copy/wp operations Message-ID: References: <20220619233449.181323-1-namit@vmware.com> <20220619233449.181323-3-namit@vmware.com> <506888c0-c257-e2a8-9540-823acdd403db@redhat.com> MIME-Version: 1.0 In-Reply-To: <506888c0-c257-e2a8-9540-823acdd403db@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655826182; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hRM/IPyK/hIppcpaCKXaGCHfiHq2WMovtiAVHxMZd9s=; b=VSKxEMvYH53u9k9+SFhW7ZaXGVQFoM/DirBZNYlVsCJvQ6SJX7tQLt4p0EAPEt3ts6j8o5 MNywYzyxINT1ItP5Er9fiWEW/taswRlTW7CNjlhqjJkiO7A4CA2fIaXNwHBKGa5kJ+L8TY ccab4TVE7vv0bVzZXxT5g4SYjxg8MdI= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=d4IvGiYo; spf=none (imf03.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655826182; a=rsa-sha256; cv=none; b=1EnzZWHqv+mpeR54vD7QYFwriIDhBJonhHa2vl7ZTLiPq4jnJ7+OGsQEIsK9bdw5BlynCZ dl10GYnOYqmuPsBzwrsu2iz2qhewoML8Q2MQk6uQIyWnhDFFAKwDWAAvvHnIrpVdixT6tK 1xZOo9p0ewUZGkW2uF5ExYrMrchDCZ4= X-Stat-Signature: rwqkicp9qskiozdae7c9t7agpjpwz3qh X-Rspamd-Queue-Id: 2D761200AF X-Rspamd-Server: rspam11 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=d4IvGiYo; spf=none (imf03.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-HE-Tag: 1655826181-915772 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 10:48:51AM +0200, David Hildenbrand wrote: > > @@ -1871,6 +1877,7 @@ static int userfaultfd_continue(struct userfaultfd_ctx *ctx, unsigned long arg) > > struct uffdio_continue uffdio_continue; > > struct uffdio_continue __user *user_uffdio_continue; > > struct userfaultfd_wake_range range; > > + uffd_flags_t uffd_flags; > > > > user_uffdio_continue = (struct uffdio_continue __user *)arg; > > > > @@ -1898,10 +1905,12 @@ static int userfaultfd_continue(struct userfaultfd_ctx *ctx, unsigned long arg) > > if (uffdio_continue.mode & ~UFFDIO_CONTINUE_MODE_DONTWAKE) > > goto out; > > > > + uffd_flags = UFFD_FLAGS_ACCESS_LIKELY; > > Can we add a comment why that makes sense? I think I know why -- someone > is stuck waiting for that continue to happen :) I think we shouldn't apply it by default for CONTINUE at all, at least not sololy for CONTINUE. CONTINUE can be used similarly as COPY at least in VM migration use case, afaict, so we can proactively install pgtables even if the page was not faulted. [...] > > diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h > > index 005e5e306266..d9c8ce9ba777 100644 > > --- a/include/uapi/linux/userfaultfd.h > > +++ b/include/uapi/linux/userfaultfd.h > > @@ -38,7 +38,8 @@ > > UFFD_FEATURE_MINOR_HUGETLBFS | \ > > UFFD_FEATURE_MINOR_SHMEM | \ > > UFFD_FEATURE_EXACT_ADDRESS | \ > > - UFFD_FEATURE_WP_HUGETLBFS_SHMEM) > > + UFFD_FEATURE_WP_HUGETLBFS_SHMEM | \ > > + UFFD_FEATURE_ACCESS_HINTS) Is the access_hint feature gonna cover the next dirty bit patch? If so I'd suggest we add the feature declaration in a separate patch after all bits ready. Thanks, -- Peter Xu