Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2161811rwb; Fri, 2 Dec 2022 06:21:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf6b1KmDlSX/SNgRPDTofnDaGxzZ/s+W0yKekS7rMJrh3DeE3dZhMJqRAa/PieVoJjGfTxD+ X-Received: by 2002:a05:6a02:187:b0:46b:26a6:51bc with SMTP id bj7-20020a056a02018700b0046b26a651bcmr63072774pgb.204.1669990877892; Fri, 02 Dec 2022 06:21:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669990877; cv=none; d=google.com; s=arc-20160816; b=IMkr10zm3o2KhsRkIRgHB66fdvaqlJIwNyn6APfoiet7Q/qGbnNSn7zSUMxll3j6RH yj2C2q4N+DvNv++ESKolDit6a2PupwV4E1FkR27sH5tDWzvfuWhnboj7v7FQ5APfbZEA 2UOCTo8MJCiNtbaIB9yO+2hxFI4sdZ/9rEN3nUYbPfje8tZvZwxla9WaFRioUFVOQpJq Buc3cNbU6/8amYRPkoQRHMMrkxZt/VQorZoyGP2Kj6gjVTZ9r7H65iufL7m3saStM7Ay qFY9o6+OUZZiJGaFKrqUvO/9GITBt6peSazbZtC6kqXpojU1xEzIuuJ2I4iflIwKj1Gx +7NA== 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=V3DTtz+t5FOU4bKwX28Uhr0yS0o/KdcIIao94APWIXE=; b=RYmV/zTa3qIUI3Ojs8znwrUClzflnCPUEfZS9ztKSiEdNsI+0DiWstibWfNXJXO/4c fFpTZAhxf2u8YQPmwwx8PIaW4xNEBTGvBlUmIp0BceoIJYL9PruAOqc3Q//MDNcqmt/Q r0zOT5hCbd1bGqXOjpk2z30Pk4UgvKazsPIpmyxnoCEvqTDO6yM+2MRoMRcMZ04Yz7Pr Fh+TfgFle6bM/7nOQNYYQUYmHQdAojT03tNJWwNZ5DIAJ9fRZ96RmO4hz09iZsqXHqD8 qMtMvTS6OPYcVOIEP0rDmprSflMzIxpNIMZef/Eu7cxSuYXP5rV9d/AsTcG8PakaAEq9 3/0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=etrl713u; 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 mh3-20020a17090b4ac300b0020b15fcac76si11882832pjb.4.2022.12.02.06.21.07; Fri, 02 Dec 2022 06:21:17 -0800 (PST) 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=etrl713u; 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 S233411AbiLBNon (ORCPT + 83 others); Fri, 2 Dec 2022 08:44:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbiLBNoi (ORCPT ); Fri, 2 Dec 2022 08:44:38 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D457DD78C4; Fri, 2 Dec 2022 05:44:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669988676; x=1701524676; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=skS3MR2BvQKKKmac1ZclTHHuTXnPM7lSX4PdHSON5iM=; b=etrl713uP9zPN4Y7zzOnpu5bmc+dZ/UHIghKHo1yCxupTaAkrFTKUBaY t4oc46tu8uZ8kkVhwqlV5wk7FYmCZTp4bn4DU0qR1fvvbnCoLMwOTcQwY KyWPe1dM3gcRzgCwwsJW2Pvn8B36fT+vL8QwXI3zGWuGYWkSaKUDeJGmI XcOKz0oM4NmX6dqQuXhEBmtqARggoMic/rL4G6ljl0i4ujXm+hJ6AetCw yBSO/kCPQzE9EobLmy0B/Kk9u4MlqrjSReB22I6yUPeJVVAwP4nEtu4ue 1OhcApdKlizefoDn8GRmuom3izr80PksleDMf4MA10VloV3880DgajFx9 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="317102462" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="317102462" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 05:44:35 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="622704069" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="622704069" Received: from valeriya-mobl2.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.211.234]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 05:44:23 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id EC5D610975F; Fri, 2 Dec 2022 16:44:19 +0300 (+03) Date: Fri, 2 Dec 2022 16:44:19 +0300 From: "Kirill A . Shutemov" To: Chao Peng Cc: Vishal Annapurve , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Sean Christopherson , 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 , Yu Zhang , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , tabba@google.com, Michael Roth , mhocko@suse.com, Muchun Song , wei.w.wang@intel.com Subject: Re: [PATCH v9 1/8] mm: Introduce memfd_restricted system call to create restricted user memory Message-ID: <20221202134419.vjhqzuz5alv3v2ak@box.shutemov.name> References: <20221025151344.3784230-1-chao.p.peng@linux.intel.com> <20221025151344.3784230-2-chao.p.peng@linux.intel.com> <20221202064909.GA1070297@chaop.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221202064909.GA1070297@chaop.bj.intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 Fri, Dec 02, 2022 at 02:49:09PM +0800, Chao Peng wrote: > On Thu, Dec 01, 2022 at 06:16:46PM -0800, Vishal Annapurve wrote: > > On Tue, Oct 25, 2022 at 8:18 AM Chao Peng wrote: > > > > ... > > > +} > > > + > > > +SYSCALL_DEFINE1(memfd_restricted, unsigned int, flags) > > > +{ > > > > Looking at the underlying shmem implementation, there seems to be no > > way to enable transparent huge pages specifically for restricted memfd > > files. > > > > Michael discussed earlier about tweaking > > /sys/kernel/mm/transparent_hugepage/shmem_enabled setting to allow > > hugepages to be used while backing restricted memfd. Such a change > > will affect the rest of the shmem usecases as well. Even setting the > > shmem_enabled policy to "advise" wouldn't help unless file based > > advise for hugepage allocation is implemented. > > Had a look at fadvise() and looks it does not support HUGEPAGE for any > filesystem yet. Yes, I think fadvise() is the right direction here. The problem is similar to NUMA policy where existing APIs are focused around virtual memory addresses. We need to extend ABI to take fd+offset as input instead. -- Kiryl Shutsemau / Kirill A. Shutemov