Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp863348rwr; Wed, 26 Apr 2023 07:18:27 -0700 (PDT) X-Google-Smtp-Source: AKy350YMGMW0vO7ILuq6wMi73236OIqNWvzp2AU6z/M2HSwcx+GrpbOmIpsshfzTeHNFOdEjFF5O X-Received: by 2002:a05:6a00:1991:b0:63f:24f1:adac with SMTP id d17-20020a056a00199100b0063f24f1adacmr22859637pfl.25.1682518706566; Wed, 26 Apr 2023 07:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682518706; cv=none; d=google.com; s=arc-20160816; b=DdEkIjPcR2sOrkT4nVLUTbn4yHYQNYu/osgI3HpOSsSW87wP8aCw14r/jhDKb2ZCKL VylwKxXMPGKaVqwF0SgT7G972X9dl9RnPXso4ve3n4tt/RVn3p8LYDxCVpAAyEKj9O1W ZLHIH3VvTVnpe4dy6Mzz/nZHRDuKNvKwFHOyiK8tb0grvJ+s55LrQ4+NbsC17BKqYD6h QJvIKjd9nhGDkCU6WJFyGLlEIuduU97fJQnVR5kL6XbCRKea9mrMRQ+Y7wZpOPnwGZCt mhOrNCN6nEq5vf7ZYCUES5H5CVsYYfCt+mSCCxVGrTgG4p+NIBVIpAezcpvDQkG1ArtX EoXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZY/DGd7KWtJA1mhxoodB4vkh85XMWSpyoDAgN9JXUHw=; b=T1qUhfBtPl/w5y8Qu2l5E9qSlblGBt0rxsins8//3fVJbK7UlyC2XZtp0B+85VDsPr jWWLS1YZ7PkN0YG9kmZBvyN0J8JEutR+Z/HqvSdFr3Iv61p63ZHs0fGxFaXVdx/zshO8 2Jq06htQ6qL5kVPfhBS7XB7HcCJ4kvv0/w+oOJ91hw3sqqk/FlQtNYpP/XOddTi2fXqj myCL1w6eVykgx5ypDqE+8sI05YEPhDEvJEaIfNI6rORHZa7PMa1JuNV/jdjhuNhuTBVx /nkQpKkZv01f7rBFgDZo+atdfi/8MB/djNXjxHTbdASGy3x7DSLvxfEK1yJE+LKa2bH5 6J5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KOpQjR3G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b004a4eae7c943si15424167pgb.535.2023.04.26.07.18.15; Wed, 26 Apr 2023 07:18:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KOpQjR3G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241262AbjDZOOi (ORCPT + 99 others); Wed, 26 Apr 2023 10:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241258AbjDZOOf (ORCPT ); Wed, 26 Apr 2023 10:14:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD0F66A79 for ; Wed, 26 Apr 2023 07:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682518426; 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=ZY/DGd7KWtJA1mhxoodB4vkh85XMWSpyoDAgN9JXUHw=; b=KOpQjR3GwKUH81I9JV6G26Mxauaxn8pVTHp0pt6o8+9jyV1kbyM7WSaoj2DXFllJCCS/k+ wxGl/Zm6Y9pobtKx0w9GlI7dHHBGh2mbAX2sBzhEfB+t53swbIv9GJWm9Ev/Ntsv7t4DJV ucYrUHNA46M9D9uMb4yZHjcoLmdg/XM= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-292-TcgxbSkPNZmSTXnt30DUqQ-1; Wed, 26 Apr 2023 10:13:36 -0400 X-MC-Unique: TcgxbSkPNZmSTXnt30DUqQ-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-74e0dd4e504so37814985a.0 for ; Wed, 26 Apr 2023 07:13:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682518410; x=1685110410; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZY/DGd7KWtJA1mhxoodB4vkh85XMWSpyoDAgN9JXUHw=; b=CKZBxFHL1ZNlYaBx1OGOoSeYDl8ka+m1Uvil583vYFl+hzrZkNjS4R7qeuXOq1AOrT APIYspZqNMqWoXbf9FQL5Kti3h5eh8kJXyz5p+hJE7CiF/EXXzdvWcEIRVKIHLeO1hT7 a9dcveOEFYBNESFNQvmMvlyT3Gnnm7Hh2K8Hwp9XIg0rpy0XvzRR73AUqPtiJi7nQQ9t H71fKCu2W/65Wk5SftWLDbLBY9rMVCitHO9GbSC8+IQddjSE+s76ky8CqNrlniljB6Js aY3ddUM+o/0befe5znsp6Snn3a3BdvTPGTgoc3Jc6qG4uVtLfuIun/G1bW7VAevFaiQQ 6pHg== X-Gm-Message-State: AAQBX9dCLI7UnUXuOai899jbSB80NzcraZqugWJmTwjCfCAwN4PEJemf z7rUdcK8t/MoWCc2g7+0rAHXX8uR0GA21CWKa8cNEXpW5TamRZUqTbGk5VKIaR39cdm9ZgafnsU laIMzzk/PYLnzl4yIq4TdEJAK X-Received: by 2002:a05:622a:1818:b0:3ef:59e8:511f with SMTP id t24-20020a05622a181800b003ef59e8511fmr35114552qtc.0.1682518410344; Wed, 26 Apr 2023 07:13:30 -0700 (PDT) X-Received: by 2002:a05:622a:1818:b0:3ef:59e8:511f with SMTP id t24-20020a05622a181800b003ef59e8511fmr35114509qtc.0.1682518410050; Wed, 26 Apr 2023 07:13:30 -0700 (PDT) Received: from x1n (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id y19-20020a05622a121300b003e390b48958sm2613867qtx.55.2023.04.26.07.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 07:13:29 -0700 (PDT) Date: Wed, 26 Apr 2023 10:13:27 -0400 From: Peter Xu To: Muhammad Usama Anjum Cc: Paul Gofman , Alexander Viro , Shuah Khan , Christian Brauner , Yang Shi , Vlastimil Babka , "Liam R . Howlett" , Yun Zhou , Cyrill Gorcunov , =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrew Morton , Suren Baghdasaryan , Andrei Vagin , Alex Sierra , Matthew Wilcox , Pasha Tatashin , Danylo Mocherniuk , Axel Rasmussen , "Gustavo A . R . Silva" , David Hildenbrand , Dan Williams , linux-kernel@vger.kernel.org, Mike Rapoport , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Greg KH , kernel@collabora.com, Nadav Amit Subject: Re: [PATCH RESEND v15 2/5] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs Message-ID: References: <20230420060156.895881-1-usama.anjum@collabora.com> <20230420060156.895881-3-usama.anjum@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Muhammad, On Wed, Apr 26, 2023 at 12:06:23PM +0500, Muhammad Usama Anjum wrote: > On 4/20/23 11:01 AM, Muhammad Usama Anjum wrote: > > +/* Supported flags */ > > +#define PM_SCAN_OP_GET (1 << 0) > > +#define PM_SCAN_OP_WP (1 << 1) > We have only these flag options available in PAGEMAP_SCAN IOCTL. > PM_SCAN_OP_GET must always be specified for this IOCTL. PM_SCAN_OP_WP can > be specified as need. But PM_SCAN_OP_WP cannot be specified without > PM_SCAN_OP_GET. (This was removed after you had asked me to not duplicate > functionality which can be achieved by UFFDIO_WRITEPROTECT.) > > 1) PM_SCAN_OP_GET | PM_SCAN_OP_WP > vs > 2) UFFDIO_WRITEPROTECT > > After removing the usage of uffd_wp_range() from PAGEMAP_SCAN IOCTL, we are > getting really good performance which is comparable just like we are > depending on SOFT_DIRTY flags in the PTE. But when we want to perform wp, > PM_SCAN_OP_GET | PM_SCAN_OP_WP is more desirable than UFFDIO_WRITEPROTECT > performance and behavior wise. > > I've got the results from someone else that UFFDIO_WRITEPROTECT block > pagefaults somehow which PAGEMAP_IOCTL doesn't. I still need to verify this > as I don't have tests comparing them one-to-one. > > What are your thoughts about it? Have you thought about making > UFFDIO_WRITEPROTECT perform better? > > I'm sorry to mention the word "performance" here. Actually we want better > performance to emulate Windows syscall. That is why we are adding this > functionality. So either we need to see what can be improved in > UFFDIO_WRITEPROTECT or can I please add only PM_SCAN_OP_WP back in > pagemap_ioctl? I'm fine if you want to add it back if it works for you. Though before that, could you remind me why there can be a difference on performance? Thanks, -- Peter Xu