Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp278568rwb; Thu, 22 Sep 2022 18:08:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NtrSkRXL9F/9TdcKbP2oWm9LEgELttjHhrBgfNjJ7nJUCiucGXe6A9IFRjv7UFaKtRxr9 X-Received: by 2002:a63:4750:0:b0:43c:dac:9e4b with SMTP id w16-20020a634750000000b0043c0dac9e4bmr5368872pgk.300.1663895291208; Thu, 22 Sep 2022 18:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663895291; cv=none; d=google.com; s=arc-20160816; b=z3vpdSpTVV9IeCwXJOGMcnDBGvrgN1R/myAlvKXngtIvxZRZPwhQvxzvfroyuT/JKT xh/5zwU7uuJZbjNwEBPz/mzpMsxClsQqWcTU3Mg5GLJwZvQsa69Y4zfU0fqZYjtQrP84 fyMoHeV4MK1NeBrZr5Dy9W1IR4FYI+v5qugYP7skbWSRCBv3UOb7iSD49uGk+y2xSTod +ZTkOVf2KAXUjAIOALBfuHZaU7EPIo6uhj3oLzaP1fAB+Fa42NIem2+b20ZaPRGRu9sB nPF+qOyzqi2XjkUBLOicMI6Vciy3ICsO+DAYpVlCAZj10UfXyehEuTq/ngSIsOLZ4CbT hlCw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2D/rxUUceEPhNIhpe4F0FMu/oIZ5DayhRhMwIXtL/nQ=; b=Yn0f2+BzPqRokk4hshM13TOVyu9Pg5rvx9x+7rcKjfwfCccmwqxmrwyQyW5pJM8OPJ qnbDKFYcjJQ6dx3HAKL5IYzHid4pmf9QWzbsfSBU21ykGWcXgDqrwlUFlI1/8VF3xDc+ +i8y/O4sli+px8wwTFGOapx4sbbNENOBvqQ2q0nU2szYdt9npkMDERtHYcuX4e10tUDk 7Yj+JTGI/guTrk0mp6IWU/NC8S5V6hC2s2zFEc1OfHb21NHVI0Gndsh0nce3I8Keh6+B A6mGaXwpPWFwN0dZVarRfDekQs6RefeFd6ePNXRzOhDGWA/HJaaTKdRmPlOakoex/gsW jxVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j0npw3hx; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n25-20020a634d59000000b00438c64bda21si8122652pgl.326.2022.09.22.18.07.59; Thu, 22 Sep 2022 18:08:11 -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=@intel.com header.s=Intel header.b=j0npw3hx; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231491AbiIWAxj (ORCPT + 99 others); Thu, 22 Sep 2022 20:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbiIWAxd (ORCPT ); Thu, 22 Sep 2022 20:53:33 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 336C563D3; Thu, 22 Sep 2022 17:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663894412; x=1695430412; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=N5ROSjhMMMcLpyjlHpJbtQYkQW/pwctSUSnQMueHIwE=; b=j0npw3hxIhk/PNb5lDfzUqD6jLjrltPDSjqtLFQjLyRdomVN6bRefFHz uXvWfgG4uz2MxxCNbni1bBuYLUa+koUygb7dcUoPhN2odkzkEqsUE2Wob Fo3ygUUA51auPuT+HUNkVklb8KJxTyVHf8P3Nv4GF0eEHysOqNnxnR5jK a+aoyB5TILiFMiHOHcYb4b+G3B3EocQyJuAwQzMVBtEvZSutXObl/iFrY gYXU6YQKmcVmT+UImswR9TWKMm2m/x/gVKgcmicaxRHWA+kzIVIcNHalx KMF697UTmPER7m2tv6+hrcdtos4Dsv4g4RgjJkJoqemIe2EOLD0fxzTul Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="283569063" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="283569063" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 17:53:31 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="622334850" Received: from dnessim-mobl1.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.60.183]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 17:53:21 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 6B9DA104532; Fri, 23 Sep 2022 03:53:19 +0300 (+03) Date: Fri, 23 Sep 2022 03:53:19 +0300 From: "Kirill A . Shutemov" To: Sean Christopherson Cc: "Wang, Wei W" , Chao Peng , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "linux-fsdevel@vger.kernel.org" , "linux-api@vger.kernel.org" , "linux-doc@vger.kernel.org" , "qemu-devel@nongnu.org" , Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "x86@kernel.org" , "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Lutomirski, Andy" , "Nakajima, Jun" , "Hansen, Dave" , "ak@linux.intel.com" , "david@redhat.com" , "aarcange@redhat.com" , "ddutile@redhat.com" , "dhildenb@redhat.com" , Quentin Perret , Michael Roth , "Hocko, Michal" , Muchun Song Subject: Re: [PATCH v8 1/8] mm/memfd: Introduce userspace inaccessible memfd Message-ID: <20220923005319.wkzpl36uailh4zbw@box.shutemov.name> References: <20220915142913.2213336-1-chao.p.peng@linux.intel.com> <20220915142913.2213336-2-chao.p.peng@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 On Thu, Sep 22, 2022 at 07:49:18PM +0000, Sean Christopherson wrote: > On Thu, Sep 22, 2022, Wang, Wei W wrote: > > On Thursday, September 15, 2022 10:29 PM, Chao Peng wrote: > > > +int inaccessible_get_pfn(struct file *file, pgoff_t offset, pfn_t *pfn, > > > + int *order) > > > > Better to remove "order" from this interface? > > Hard 'no'. > > > Some callers only need to get pfn, and no need to bother with > > defining and inputting something unused. For callers who need the "order", > > can easily get it via thp_order(pfn_to_page(pfn)) on their own. > > That requires (a) assuming the pfn is backed by struct page, and (b) assuming the > struct page is a transparent huge page. That might be true for the current > implementation, but it most certainly will not always be true. > > KVM originally did things like this, where there was dedicated code for THP vs. > HugeTLB, and it was a mess. The goal here is very much to avoid repeating those > mistakes. Have the backing store _tell_ KVM how big the mapping is, don't force > KVM to rediscover the info on its own. I guess we can allow order pointer to be NULL to cover caller that don't need to know the order. Is it useful? -- Kiryl Shutsemau / Kirill A. Shutemov