Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp853724rwe; Fri, 14 Apr 2023 10:30:58 -0700 (PDT) X-Google-Smtp-Source: AKy350b5RbCvxQ6cL75PdIekSDXZ6dV2Fnb1hj6cbFoMpUifBCiIdxOtSpGx9b30m05qk01txbxJ X-Received: by 2002:a05:6a20:19a6:b0:db:a9e7:9bbb with SMTP id bz38-20020a056a2019a600b000dba9e79bbbmr6769171pzb.48.1681493457937; Fri, 14 Apr 2023 10:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681493457; cv=none; d=google.com; s=arc-20160816; b=AIsOLBWHqqiLnESk5fW9C/Lj+JDegruww4CiVX/mSFyhAxsTYYdvY257z4Dd+kvwS5 95Xu0JIwJeWgEDPfeUAptFTY8s5Jclpl7yfZBUD4kB+OrQP5y3AGRQ9k10C21vSsVcgO wDo7Gh7E4d7NAa8aweCl5NBM5ZGmAD3kzu2xTtleZ6VKXVqe/Ogcc8p3Zjrya4TKtJaK 86QlLL0C9Ofo59AAEzxUMlYGSWSvjx5SGRDdmxlw8XTM37rKpECnHxoLwuuq0K3U5lLw Yn+JYELudyLslrx1QnHx6RVEKOCGbFRHyFf2JvRsIhLWgeNndpdnx8KQAjChwFk+vcum thVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=1suTIWWaXvrjwoXvee3hiPz1nCSIoJ8zBj0cMHmSI7Y=; b=nP/Xil2apZFAFfWLlEqawj18+7G6uCXXP4/yInIBA7o8sn2cju6RpTUAX1NPilQelZ GKj+ZUFsWxXjEk4PVTfHN9/W9lsDCrtGHvcxlV9V66KnlBMvUraDs84A2eBkG/E6QR9X 4SJ8kJ3ckjqxOmoTyoyBAIBvAFAFEOCDS8cFipb56I1pYpbkbJW3Jf5iqZKVZ3Rs+xnq EGNZGXg6qU/3I7OUn1QQGcHokepN1bSvTxWewHgvny3AOeLG3d1PVZjsEFIxGzCGbQhV zHMrpjvU4zuZ54bw9ZDg9JinYKrBgbEzt9FixjRtf8D1PK9LVkWSMZdGYyCQwCQr2a5s EZUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=ikLyr+8X; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u59-20020a17090a51c100b00244af8c2956si7380843pjh.126.2023.04.14.10.30.43; Fri, 14 Apr 2023 10:30:57 -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=@google.com header.s=20221208 header.b=ikLyr+8X; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbjDNR0t (ORCPT + 99 others); Fri, 14 Apr 2023 13:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbjDNRYk (ORCPT ); Fri, 14 Apr 2023 13:24:40 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06B95C141 for ; Fri, 14 Apr 2023 10:24:23 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id l124-20020a252582000000b00b8f5572bcdaso6568932ybl.13 for ; Fri, 14 Apr 2023 10:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681493062; x=1684085062; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=1suTIWWaXvrjwoXvee3hiPz1nCSIoJ8zBj0cMHmSI7Y=; b=ikLyr+8Xr+H5vM/bYsln0btIfSDwhlyv3SopCKg3euLB29KjQafs0AtMmmr4T9EIfJ vIPC9xf1NxKqXFWckbIj0WVo4SgvKsPOQl1cOwpgB/XV40BLqns/ryvTGzxH0hPTIol7 xarcJ0GqxJFOJTIObBYAoUoAUl0iAOmFpm7/8rkUekiKozgid1NlTMyN45x5pS33IxKE d8HkpLc19gk/5O6gbpIr0ZptEhH2xIi2xu1OHofuLnINm9CQonnrWxwWMzsJ6C8Y+skF MUVvqijzMdtqQ30NGAKrF5+eZpQbbmVeMtcc7lOWf3BPP1QJqZGJHkM9DCvCxyboG1b4 logA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681493062; x=1684085062; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1suTIWWaXvrjwoXvee3hiPz1nCSIoJ8zBj0cMHmSI7Y=; b=kvIG0ZTJvNK2uFPum9V8uLQNdpiVBRD8q+a+BTq9ggIssyw3N9YuI/+4qVowDFJC52 1VY5P6E4EfA6XHsyWkpqf5znR+ReRvbx8neIF1pxz6IeCuQSd6VOun98PKcWis0b4OxY qhnc55DtgAtWvEanK+7CrJUX/L7Nnox/M9BTlZ8dkdoRuHg3hYnjfCzE4je7CmZagerx jMd5V5INW+eMYwfv/CE2pVW+Kh+SEbKTXmmiEHmlzmj1fJU2xy/dMb2XzEZNsCwRlaW5 V5eVaQGOQWn/hhG00kjcETYZD7PJpCe97usLjosh7wmQBjc3ObxyWZMSR4ffngkART3C Dv4A== X-Gm-Message-State: AAQBX9dVlGErTinzQet+3gvneady/owYy0bS/PzlzNtyjRg1Rw1W1lYP mlysLVRvy/O6vg93+mMkjJk0eno2d/4= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:b621:0:b0:54c:bf7:1853 with SMTP id u33-20020a81b621000000b0054c0bf71853mr4241791ywh.6.1681493062225; Fri, 14 Apr 2023 10:24:22 -0700 (PDT) Date: Fri, 14 Apr 2023 17:24:20 +0000 In-Reply-To: Mime-Version: 1.0 References: Message-ID: Subject: Re: [RFC PATCH 0/6] Setting memory policy for restrictedmem file From: Sean Christopherson To: Michal Hocko Cc: Ackerley Tng , kvm@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, qemu-devel@nongnu.org, aarcange@redhat.com, ak@linux.intel.com, akpm@linux-foundation.org, arnd@arndb.de, bfields@fieldses.org, bp@alien8.de, chao.p.peng@linux.intel.com, corbet@lwn.net, dave.hansen@intel.com, david@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, hpa@zytor.com, hughd@google.com, jlayton@kernel.org, jmattson@google.com, joro@8bytes.org, jun.nakajima@intel.com, kirill.shutemov@linux.intel.com, linmiaohe@huawei.com, luto@kernel.org, mail@maciej.szmigiero.name, michael.roth@amd.com, mingo@redhat.com, naoya.horiguchi@nec.com, pbonzini@redhat.com, qperret@google.com, rppt@kernel.org, shuah@kernel.org, steven.price@arm.com, tabba@google.com, tglx@linutronix.de, vannapurve@google.com, vbabka@suse.cz, vkuznets@redhat.com, wanpengli@tencent.com, wei.w.wang@intel.com, x86@kernel.org, yu.c.zhang@linux.intel.com, muchun.song@linux.dev, feng.tang@intel.com, brgerst@gmail.com, rdunlap@infradead.org, masahiroy@kernel.org, mailhol.vincent@wanadoo.fr Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 On Fri, Apr 14, 2023, Michal Hocko wrote: > On Fri 14-04-23 00:11:49, Ackerley Tng wrote: > > 3. A more generic fbind(): it seems like this new functionality is > > really only needed for restrictedmem files, hence a separate, > > specific syscall was proposed to avoid complexities with handling > > conflicting policies that may be specified via other syscalls like > > mbind() > > I do not think it is a good idea to make the syscall restrict mem > specific. +1. IMO, any uAPI that isn't directly related to the fundamental properties of restricted memory, i.e. isn't truly unique to restrictedmem, should be added as generic fd-based uAPI. > History shows that users are much more creative when it comes > to usecases than us. I do understand that the nature of restricted > memory is that it is not mapable but memory policies without a mapping > are a reasonable concept in genereal. After all this just tells where > the memory should be allocated from. Do we need to implement that for > any other fs? No, you can safely return EINVAL for anything but > memfd_restricted fd for now but you shouldn't limit usecases upfront. I would even go a step further and say that we should seriously reconsider the design/implemenation of memfd_restricted() if a generic fbind() needs explicit handling from the restricted memory code. One of the goals with memfd_restricted() is to rely on the underlying backing store to handle all of the "normal" behaviors.