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 5B804C07E9D for ; Mon, 26 Sep 2022 14:08:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC95F8E0057; Mon, 26 Sep 2022 10:08:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C78C28E0047; Mon, 26 Sep 2022 10:08:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B41188E0057; Mon, 26 Sep 2022 10:08:46 -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 A6B4C8E0047 for ; Mon, 26 Sep 2022 10:08:46 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7DD6FA0ACA for ; Mon, 26 Sep 2022 14:08:46 +0000 (UTC) X-FDA: 79954417452.10.64C9AC3 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf04.hostedemail.com (Postfix) with ESMTP id CC3C940019 for ; Mon, 26 Sep 2022 14:08:45 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A1B451F8A4; Mon, 26 Sep 2022 14:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1664201324; 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=j600WWM/VHOKFyO6Qxlx/kgR3oXfjp923FSo/xkqVEo=; b=qYELV+5U/XVCqd6kESY7/gFf387nX8FJynNLNsM3BnQWoIagPjdK7IGMl1iFWBzlOeod/9 M1vErEEHSaNoJznOOokLM0fFnbd14vY3PPtZBsc8IA1yQoFtKLWmI/Hf/eAmHB51DKO0VC DxEY0i3ZHBXuoKoEq2kjQHBHUTb3XZs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7F18A139BD; Mon, 26 Sep 2022 14:08:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cuHOGWyyMWPMAQAAMHmgww (envelope-from ); Mon, 26 Sep 2022 14:08:44 +0000 Date: Mon, 26 Sep 2022 16:08:43 +0200 From: Michal Hocko To: Zhongkun He Cc: corbet@lwn.net, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, wuyun.abel@bytedance.com Subject: Re: [External] Re: [RFC] proc: Add a new isolated /proc/pid/mempolicy type. Message-ID: References: <20220926091033.340-1-hezhongkun.hzk@bytedance.com> <24b20953-eca9-eef7-8e60-301080a17d2d@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24b20953-eca9-eef7-8e60-301080a17d2d@bytedance.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664201325; a=rsa-sha256; cv=none; b=XAaVDHDt5LmTe0QxE/sCZI9sV1JzVtnNgz7SnUudeJ5D8Y+QOj77f/hXZQxcZR+sifqhPw bpPJQuPzhJKUWnzVVzi5RUfHuNyCOHN16DxfkHXjXachMC59UxNERI3ZgFaiFKwKFnXykO HWWcj7qO3aOSLio85WCOFZ+0q/mXqIM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=qYELV+5U; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf04.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 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=1664201325; 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=j600WWM/VHOKFyO6Qxlx/kgR3oXfjp923FSo/xkqVEo=; b=NRSCHkzC+Y/keH5Z9bnmfa6Ct6tg55qWzKnmOBzvM9Peq/4rRPvwsuzrM1CB85sefctCT3 bCItTmTn35RHhb1x8i7gLNAppqkQC+lY3q8CLYO3RZ7/Eay4DgRfDeHfVSWXT8VQxO6/Ni F3KgOO2Mt9rHQjNRhYRlY1eknfAVSLE= X-Rspam-User: X-Rspamd-Queue-Id: CC3C940019 X-Rspamd-Server: rspam08 X-Stat-Signature: 1t78cpbyiq1icf8m9i3dmrsg881o57yo Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=qYELV+5U; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf04.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1664201325-26646 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 Mon 26-09-22 20:53:19, Zhongkun He wrote: > > [Cc linux-api - please do so for any patches making/updating > > kernel<->user interfaces] > > > > > > On Mon 26-09-22 17:10:33, hezhongkun wrote: > > > From: Zhongkun He > > > > > > /proc/pid/mempolicy can be used to check and adjust the userspace task's > > > mempolicy dynamically.In many case, the application and the control plane > > > are two separate systems. When the application is created, it doesn't know > > > how to use memory, and it doesn't care. The control plane will decide the > > > memory usage policy based on different reasons.In that case, we can > > > dynamically adjust the mempolicy using /proc/pid/mempolicy interface. > > > > Is there any reason to make it procfs interface rather than pidfd one? > > Hi michal, thanks for your reply. > > I just think that it is easy to display and adjust the mempolicy using > procfs. But it may not be suitable, I will send a pidfd_set_mempolicy patch > later. proc interface has many usability issues. That is why pidfd has been introduced. So I would rather go with the pidfd interface than repeating old proc API mistakes. > Btw.in order to add per-thread-group mempolicy, is it possible to add > mempolicy in mm_struct? I dunno. This would make the mempolicy interface even more confusing. Per mm behavior makes a lot of sense but we already do have per-thread semantic so I would stick to it rather than introducing a new semantic. Why is this really important? -- Michal Hocko SUSE Labs