Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp208920rdd; Wed, 22 Nov 2023 13:34:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDH5mIXQnZBVcNWFmNfP/TEeMLb11hznuXH/CydlUqtPb+hBQZTJPUB9E+k7BB/z2iybNe X-Received: by 2002:a05:6808:1804:b0:3ae:5bf5:4ad1 with SMTP id bh4-20020a056808180400b003ae5bf54ad1mr4745900oib.33.1700688869748; Wed, 22 Nov 2023 13:34:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700688869; cv=none; d=google.com; s=arc-20160816; b=D9A153FkeVrLiIaimsPSlifF/JwU6LEB2blXbGBwjLQ8C+wep5xOzHCp9a7YM5fq4h eEzNEGimpp9uPRfEk/Sd6peX8MT+gD1W5Yqb7HnSdVVkSAvF7Yo3RboY7vHLfI4i94ES O+VmVq4AzkFtnfas3qTp7MmybaPrj1bARyk1aV2SWtwHNIpQFqd6uEZUX7z3Vm/TEjuj +W7qV2KGZQHY7FxOCMrgYQOD+A8g+lLNh2/hM5qS8grtA0xYuAVWHI1HIj0ydQUkLFsf hQ4QNrBZ6IuPmJSXpSeHWM0epyuaiviSve3eTCJ+MTPynK+PO2JUXcf0nA46VvHq/NES z/dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Mt84CK3SfwBCiLh2LelSk0vRPyiHnZgfpc6l+0AG1Go=; fh=e1snCMGa4Lf5XR6VkXpoNUoDrZwWi7oE8i5y3sI+olE=; b=XMKtOf4VEgX+a+dV9pel6CrAxFN/m6DXZ8TeN+K4N+Ha2THj/uOPQ1ynlGxFlAEReF D+kqPtOm86YpbrU+bYquuUnjEY51m6d5WYoDVmrm4/dbq9a4b6KgwLEp2wanOlzkGxJG WC24Z2n6oJtLnGSBX2NcXKDDUXTFARfXYJtnp0v2CU+bVhDJUV/absNbv68YTAujIss1 MTx2m+UemzkjI6zP6iBGpGA9+7tPQA26DaDZY4kQbstGwBOkTyumFk59UvE9nNhpDJIF h4oXGMp6SjjMYF+DFUR8kDmwWI+jPNlG+dRfAM6hBb148rGeKwXOnBwQq9IqHKg8YT+x F4nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=a9T8JgpH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 32-20020a630a20000000b005be33e97880si300913pgk.167.2023.11.22.13.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 13:34:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=a9T8JgpH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 15897825A6C0; Wed, 22 Nov 2023 13:33:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231730AbjKVVdy (ORCPT + 99 others); Wed, 22 Nov 2023 16:33:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbjKVVdx (ORCPT ); Wed, 22 Nov 2023 16:33:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22527A4 for ; Wed, 22 Nov 2023 13:33:50 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 216ECC433C7; Wed, 22 Nov 2023 21:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1700688829; bh=CCGiBp6ijIbiQN49IM0yNAMFM6x8RmE/GApUZ80sKhk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=a9T8JgpHz5rCww2lmiWFAgJiYQz4lQnKLd+N/wJREBIzFj2s77dIv23vFbVfIT9GL dYS5ISI7BaGwajylptbeE4CbFzWkGsDed74VdXV5ZAH6c7ZfBstkSddhZsFb82ORIs +7sOq27xvaEWQzLNx0SteALC+cjD+zL6q9xcPca4= Date: Wed, 22 Nov 2023 13:33:48 -0800 From: Andrew Morton To: Gregory Price Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, tglx@linutronix.de, luto@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, mhocko@kernel.org, tj@kernel.org, ying.huang@intel.com, Gregory Price Subject: Re: [RFC PATCH 00/11] mm/mempolicy: Make task->mempolicy externally modifiable via syscall and procfs Message-Id: <20231122133348.d27c09a90bce755dc1c0f251@linux-foundation.org> In-Reply-To: <20231122211200.31620-1-gregory.price@memverge.com> References: <20231122211200.31620-1-gregory.price@memverge.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 13:33:55 -0800 (PST) On Wed, 22 Nov 2023 16:11:49 -0500 Gregory Price wrote: > The patch set changes task->mempolicy to be modifiable by tasks other > than just current. > > The ultimate goal is to make mempolicy more flexible and extensible, > such as adding interleave weights (which may need to change at runtime > due to hotplug events). Making mempolicy externally modifiable allows > for userland daemons to make runtime performance adjustments to running > tasks without that software needing to be made numa-aware. Please add to this [0/N] a full description of the security aspect: who can modify whose mempolicy, along with a full description of the reasoning behind this decision. > 3. Add external interfaces which allow for a task mempolicy to be > modified by another task. This is implemented in 4 syscalls > and a procfs interface: > sys_set_task_mempolicy > sys_get_task_mempolicy > sys_set_task_mempolicy_home_node > sys_task_mbind > /proc/[pid]/mempolicy Why is the procfs interface needed? Doesn't it simply duplicate the syscall interface? Please update [0/N] with a description of this decision. > The new syscalls are the same as their current-task counterparts, > except that they take a pid as an argument. The exception is > task_mbind, which required a new struct due to the number of args. > > The /proc/pid/mempolicy re-uses the interface mpol_parse_str format > to enable get/set of mempolicy via procsfs. > > mpol_parse_str format: > [=][:] > > Example usage: > > echo "default" > /proc/pid/mempolicy > echo "prefer=relative:0" > /proc/pid/mempolicy > echo "interleave:0-3" > /proc/pid/mempolicy What do we get when we read from this? Please add to changelog. > Changing the mempolicy does not induce memory migrations via the > procfs interface (which is the exact same behavior as set_mempolicy). >