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 48CEFC77B6E for ; Fri, 14 Apr 2023 17:24:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 98DE2900002; Fri, 14 Apr 2023 13:24:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 916EF6B0075; Fri, 14 Apr 2023 13:24:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DEEF900002; Fri, 14 Apr 2023 13:24:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6F57F6B0072 for ; Fri, 14 Apr 2023 13:24:25 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0D601A0175 for ; Fri, 14 Apr 2023 17:24:25 +0000 (UTC) X-FDA: 80680670490.25.3E1C968 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf10.hostedemail.com (Postfix) with ESMTP id 2870FC001F for ; Fri, 14 Apr 2023 17:24:22 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=ikLyr+8X; spf=pass (imf10.hostedemail.com: domain of 3Row5ZAYKCG0dPLYUNRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--seanjc.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3Row5ZAYKCG0dPLYUNRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--seanjc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681493063; 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=1suTIWWaXvrjwoXvee3hiPz1nCSIoJ8zBj0cMHmSI7Y=; b=yW/UOUW5uvjvwwq3MoOrLCbnWw74L20VIvw+uS5jjdzZOBOv0R1eg0y4F0LNBSFrn4WdB6 f1DENsBD33QMQgECnFBkSvEjSu9W+xZBEakNOfS5NYPvsoHCKhyXM7V8LQh3aUruSFc5Tj YX3cLAorsy+6rCizbTvYP+1/quD2CE0= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=ikLyr+8X; spf=pass (imf10.hostedemail.com: domain of 3Row5ZAYKCG0dPLYUNRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--seanjc.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3Row5ZAYKCG0dPLYUNRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--seanjc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681493063; a=rsa-sha256; cv=none; b=KVtqDV/+uLFywdqim0GYKmqrpxdfW58RJQy1uwNL2slfc8uey2tjr1uSvZR665zeK5xX2Y /07tE3aqQDK2wno2k92ZRP+Mf+13WlGPrglPnw3I/s3kMxdEWpPd1/d9kPVbFoYvnZhaFJ 4htoApMit0CPE3A4HKvZ1zcn/VbaQO4= Received: by mail-yb1-f201.google.com with SMTP id 132-20020a250c8a000000b00b8f4e12dd57so7801394ybm.1 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=NLvzRN0SZU5DcyO1/ntIp5TaEFM85jRHaXiJ9HivVe4833u1JUf/9qVzoMtH1BXWSU J0/6fPmiYq4nkT+vCZ7wqcb2uDJl0v22fdmOQhO0P0U0Tx4h5XZYNGkBdrbyvHA7dWL3 qXRNGv2CdrgmCAgwrOSYrFLp3mK/vPmAtAxMWltwXyzr5yVdnnhwz056xvc6+NJm+ATh DqQ7otAu6RS7aXZKGwkI/uUK9qYp3KrP4XIENi783Pv3Q1NlsSNCgeBxWeW7Z9TbT7B7 DQREL4N4xH9KY33T8sc+ZWfgo838kopEC80j3P1o4Y/CgqtSx5v1zTSquGx9U7qPgPr6 GW8Q== X-Gm-Message-State: AAQBX9eDCQSYB+ruLD4YXQrKwPo9ZuwXtMyTXzwIEa+PeStC6pibdG1K N8a09pDapVH/V2OYmKbBSNfcSLTf6iY= X-Google-Smtp-Source: AKy350bMntOiUpabNyzZrQez/ekmQ/pO8bA95EPMaEz7NgDSS6qOH/7lua5qHB9B+z+FW4OM+ZLtRc32bN4= 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-Stat-Signature: u7533j1btixxhdkmkwfko4y3a9y6e8c3 X-Rspam-User: X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aH8AncMaLF45fSaY6/QiqMk48Qul6qw4MEyeG9xnETN+uobu+SPyyhnGoNb5D38Ekca8Zc4EUrut/Knpf6LMoGyAWmj0VCO5AO22zKpscWvpO3GgM0m9B1n90OxEzZ5sANJuv2Ucid4+tPIj2ozSBVkcSvz6LH7DHx7BzeB5UZmRwIQNGU0BsFG+Aa/Zh1WHmJSuNOZ3G0uyL1Xd7nLJM8VwunZFhi4Vz32Vg3Nw6dIpaTYEYRoNQRsRzKdznz/18kXp9v+C5EttDJ01xcqlbGPMmXphRhGzjjKgIzHiDPTpxKGts0R5RLRrac7mL4ZtlAU6CD1wBmi8YYjH9DYDCVnXKT5BlA2b3OnxR0TUJgwi0YaBngQ/PTp0alub81Ce9S378N5XEOmYRXKKR8t84KuQ1qYANoDecdmTh4vAElFChs7RWrtdm4tkRLlL2VLP4Jwp/mAWUHhtvsWROc0SMnPghIbVWhmgVUGEbh2/zywTeiyTHhRcyNrsC418dOC4+PCwgkd2DuLhja5V2XBUGWexjNoxkTb+fNPrTMcuGg8sEa1KbXw7cv4sB1E25pCq6oC5D 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 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.