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 03404C4167B for ; Tue, 28 Nov 2023 09:45:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8868D6B0161; Tue, 28 Nov 2023 04:45:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 773FA6B0162; Tue, 28 Nov 2023 04:45:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5756B6B0163; Tue, 28 Nov 2023 04:45:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3C2E26B0161 for ; Tue, 28 Nov 2023 04:45:11 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F2AD7120176 for ; Tue, 28 Nov 2023 09:45:10 +0000 (UTC) X-FDA: 81506879580.07.EE3E863 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf12.hostedemail.com (Postfix) with ESMTP id C95604000A for ; Tue, 28 Nov 2023 09:45:08 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="S6QcIWw/"; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf12.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=1701164709; a=rsa-sha256; cv=none; b=oS1NiqgbLAd07U8X16OWeWQ9hdtW2UM0KKsykwZ3hSu946zKr1RiOIAF+aGRRDT19AtLz4 Y+Njn0ej4zTpIRZ1kCRwB9+CQEcplBrX0HH00lOszq39FDw7BWUmTwdq1Drc1it5RTbh1H Fy3eMaAzvAOvByA4MX2fHyF54rWkGUY= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="S6QcIWw/"; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf12.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=1701164709; 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=PjmgV8c/dSvki9BoDbxFb8rn9kuThbhs3kZKihqd5Ms=; b=6DwOAMEhcsT5m/HBiEEsx6tF2nslym1eQrsuKHn/hbE9pewm80wg55XXaPrhAJ26WvZ8ON 1fv9b1b0djV0Vy6vwg5DHKbfEZiK4NCePbis5XAXZOLBacvy/gALdetUbaLeIdWWSaq6ow j96gqGQCza5TpnpfYLepU+t2sy+6L1s= 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 3F8582195A; Tue, 28 Nov 2023 09:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1701164707; 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=PjmgV8c/dSvki9BoDbxFb8rn9kuThbhs3kZKihqd5Ms=; b=S6QcIWw/2fwQUd4Pv6miut4WGF6hKhISBRs6Ksh/ByqrsatBI0+AGVKiQCo+GH2AOSdThy zFkQGmtFlU1Kut3woNmZDBEzD3VrwXnCutMD+gJ5wUyKVJeKq5s0IUuHBoJYtZWcF5x+76 XLaCQfYWFWo/VV4/ze4WLkQNNINejQg= 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 1B83E1343E; Tue, 28 Nov 2023 09:45:07 +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 jw6vA6O2ZWVrZAAAD6G6ig (envelope-from ); Tue, 28 Nov 2023 09:45:07 +0000 Date: Tue, 28 Nov 2023 10:45:02 +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: rspam06 X-Rspamd-Queue-Id: C95604000A X-Stat-Signature: h5yanqb1pwewg8twosm1bppquje54mwr X-HE-Tag: 1701164708-446379 X-HE-Meta: U2FsdGVkX1/LquSMQbtoLW70xUOqyDg6Sv2sZm2+SNr1nMB6KJnQd4O8CR3WZCwVgn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+XS1/2kswqr9xNNtcpG8kQIFZ7dLzVwL6wc1QgPMyL+eXIZ5FEQY34Gn+dITn9RdkHMgYDXdBMZhmI/Ayge86KAvFEr+Xos0PydDAva+Vq6TwBHWSNdI/6TDuSVU4lmMXaX1mYXz 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: On Mon 27-11-23 11:14:44, Gregory Price wrote: > On Mon, Nov 27, 2023 at 04:29:56PM +0100, Michal Hocko wrote: > > Sorry, didn't have much time to do a proper review. Couple of points > > here at least. > > > > > > > > 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. > > Sounds good, I'll pull my get/set_mempolicy2 RFC on top of this. > > Just context: patches 1-6 refactor mempolicy to allow remote task > twiddling (fixing the current-oriented issues), and patch 7 adds the pidfd > interfaces you describe above. > > > Couple Questions > > 1) Should we consider simply adding a pidfd arg to set/get_mempolicy2, > where if (pidfd == 0), then it operates on current, otherwise it > operates on the target task? That would mitigate the need for what > amounts to the exact same interface. This wouldn't fit into existing pidfd interfaces I am aware of. We assume pidfd to be real fd, no special cases. > 2) Should we combine all the existing operations into set_mempolicy2 and > add an operation arg. > > set_mempolicy2(pidfd, arg_struct, len) > > struct { > int pidfd; /* optional */ > int operation; /* describe which op_args to use */ > union { > struct { > } set_mempolicy; > struct { > } set_vma_home_node; > struct { > } mbind; > ... > } op_args; > } args; > > capturing: > sys_set_mempolicy > sys_set_mempolicy_home_node > sys_mbind > > or should we just make a separate interface for mbind/home_node to > limit complexity of the single syscall? My preference would be to go with specific syscalls. Multiplexing syscalls have turned much more complex and less flexible over time. Just have a look at futex. -- Michal Hocko SUSE Labs