From mboxrd@z Thu Jan 1 00:00:00 1970 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 CF929C07CB1 for ; Mon, 27 Nov 2023 15:30:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5278E6B02CD; Mon, 27 Nov 2023 10:30:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D7736B02CE; Mon, 27 Nov 2023 10:30:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A05A6B02CF; Mon, 27 Nov 2023 10:30:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 29C036B02CD for ; Mon, 27 Nov 2023 10:30:03 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 019CC1A0375 for ; Mon, 27 Nov 2023 15:30:02 +0000 (UTC) X-FDA: 81504119886.20.775B603 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf23.hostedemail.com (Postfix) with ESMTP id B80C014001A for ; Mon, 27 Nov 2023 15:29:59 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=OOXAB+Dp; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf23.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701099000; 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=ll683VjO5cgdZEXvfYTUzLYylEdUG/UQv49Lu4Sc7rA=; b=5oOEc8C1Pjje1CQ3o/3p7FbOss6FKbBqM7OF+x+Qk8n+NC6amSAjiUZ1+Y1mSGv8jsIam+ ErMRoCoOhPQjFLU+wynMedCDgEmRBwnau4R8v3CC+0uQHuFZL8ALyygfm93B0cryJllLOt 57T9dBckgDJOifKApeXtCs+lX83Le7E= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=OOXAB+Dp; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf23.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701099000; a=rsa-sha256; cv=none; b=wU1PVtAcRoV8L48IudpVTY++9NFlDHUPFozFk8jbxKVpManGF0Bt645DFlqZkOvEe7lQeD aj/RTDZ+4WM01Hhs0jp/lxv+hgLurNEqyyDLlrbgo+12PVwpeYIKbJ1iBMJFECz/LATYbf ZT3k6uximjzINTpE/7jYXbUL7i/kdsU= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8CB2A21B58; Mon, 27 Nov 2023 15:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1701098997; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ll683VjO5cgdZEXvfYTUzLYylEdUG/UQv49Lu4Sc7rA=; b=OOXAB+DpFUt4iwizIQsg9NdOIv7EkWhpXPvrvm3xSPIkYK01e48JBaP6McNQXVt1W4HMcp FzhsJfz4OLu8cI2pA+kFgSSwrdgoVb/idRWXuLd+Fx/rh355mLKnibOH8SOrq1VdRhoTdr woqZH0y3y+TGG/qALZCHEensDf8Z/lc= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 714C11367B; Mon, 27 Nov 2023 15:29:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id e1MKGvW1ZGVHRQAAD6G6ig (envelope-from ); Mon, 27 Nov 2023 15:29:57 +0000 Date: Mon, 27 Nov 2023 16:29:56 +0100 From: Michal Hocko To: Gregory Price Cc: Andrew Morton , Gregory Price , 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, tj@kernel.org, ying.huang@intel.com Subject: Re: [RFC PATCH 00/11] mm/mempolicy: Make task->mempolicy externally modifiable via syscall and procfs Message-ID: References: <20231122211200.31620-1-gregory.price@memverge.com> <20231122133348.d27c09a90bce755dc1c0f251@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B80C014001A X-Stat-Signature: j4aqspgacohyy7qos7nn7fd4ibz9iees X-HE-Tag: 1701098999-435677 X-HE-Meta: U2FsdGVkX19qMgCCNqmfKN/tnG6kVfTIzoDaBslcPzQhM3njfO70i/gDB9NhMNFaH2b/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32SNw2To9P57cnHcYWmaEnlTweqUIgSgktiPB4VlbjAtaFBUNinijKRWCxiMgnL+TLYl/e2JKL5y8EqmlQ4FTmaUoBIwnduRQ1nDnct1V6vIjcmhFrFuvec81weJDyoY/4Q3oTXCMQddkLNzwAjXZwlsHJddpqBMIyzWA== 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: List-Subscribe: List-Unsubscribe: Sorry, didn't have much time to do a proper review. Couple of points here at least. On Wed 22-11-23 17:24:10, Gregory Price wrote: > On Wed, Nov 22, 2023 at 01:33:48PM -0800, Andrew Morton wrote: > > 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. > > > > Will do. For the sake of v0 for now: > > 1) the task itself (task == current) > for obvious reasons: it already can > > 2) from external interfaces: CAP_SYS_NICE Makes sense. [...] > > > 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. > > > > Honestly I wrote the procfs interface first, and then came back around > to just implement the syscalls. mbind is not friendly to being procfs'd > so if the preference is to have only one, not both, then it should > probably be the syscalls. > > That said, when I introduce weighted interleave on top of this, having a > simple procfs interface to those weights would be valuable, so I > imagined something like `proc/mempolicy` to determine if interleave was > being used and something like `proc/mpol_interleave_weights` for a clean > interface to update weights. > > However, in the same breath, I have a prior RFC with set/get_mempolicy2 > which could probably take all future mempolicy extensions and wrap them > up into one pair of syscalls, instead of us ending up with 200 more > sys_mempolicy_whatever as memory attached fabrics become more common. > > So... yeah... the is one area I think the community very much needs to > comment: set/get_mempolicy2, many new mempolicy syscalls, procfs? All > of the above? I think we should actively avoid using proc interface. The most reasonable way would be to add get_mempolicy2 interface that would allow extensions and then create a pidfd counterpart to allow acting on a remote task. The latter would require some changes to make mempolicy code less current oriented. -- Michal Hocko SUSE Labs