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 E3BF8C4167B for ; Tue, 28 Nov 2023 14:49:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 658666B0273; Tue, 28 Nov 2023 09:49:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E1666B0278; Tue, 28 Nov 2023 09:49:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 482216B02B2; Tue, 28 Nov 2023 09:49:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 339A56B0273 for ; Tue, 28 Nov 2023 09:49:14 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F3DF71C0117 for ; Tue, 28 Nov 2023 14:49:13 +0000 (UTC) X-FDA: 81507645786.03.B9F868B Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf04.hostedemail.com (Postfix) with ESMTP id C2FFD4001C for ; Tue, 28 Nov 2023 14:49:11 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=mBdDZcd9; spf=pass (imf04.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701182952; 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=AGmTk8emchkRnIZ9vc9YqHrdZi2kThKUDQIAuz1Uolw=; b=oMOfwxWBr/aUh6NBDboZVwMzM+vAfO8grALNX7w4dRH9NFxdLwjqqBekHJZLIE6fsR89zq tjy5MZ/l320CPGClHRiVWj2uVivUH0ZsxJ+UTGxAMZZKYnv6PEiKyfLGFBE9viFLNUco3Q HBoOurH7oToU/RV6ShAEhwgV4cbpD10= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701182952; a=rsa-sha256; cv=none; b=K0io5pd5xhsXU3qzeMAWYYZCr+1zy+A5AW21ul6UPUrj+1fvPyjvV/qyf88YzT6OF6DuV/ 4if6y4ImMVx4/dCZ87ZnsF9rSfSbBZdCmBAhnK9WhD8kgxq0q1JLq31jitTooX47hoTxCY MoK6W8H1gQTT0axap76PglMyE8+GqTc= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=mBdDZcd9; spf=pass (imf04.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com 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-out2.suse.de (Postfix) with ESMTPS id 1268E1F7AB; Tue, 28 Nov 2023 14:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1701182950; 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=AGmTk8emchkRnIZ9vc9YqHrdZi2kThKUDQIAuz1Uolw=; b=mBdDZcd9KOpnp6jijp/2TTuNI4abARr+OJznAuryiNL8esNd6d8hxt24jNjY5GxKISRdl4 rk985MoB8ccxv9jIslmGTbZVFBBHh5PhwdGTcQryuFGa7XVqeLkxCSY0hUJyivkIAZ2HDX oi4DuA18ebHpnewyXPXCHNDbM9ia7MM= 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 5158F13763; Tue, 28 Nov 2023 14:49:09 +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 tyvkEOX9ZWUCRQAAD6G6ig (envelope-from ); Tue, 28 Nov 2023 14:49:09 +0000 Date: Tue, 28 Nov 2023 15:49:04 +0100 From: Michal Hocko 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, akpm@linux-foundation.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, Gregory Price Subject: Re: [RFC PATCH 04/11] mm/mempolicy: modify get_mempolicy call stack to take a task argument Message-ID: References: <20231122211200.31620-1-gregory.price@memverge.com> <20231122211200.31620-5-gregory.price@memverge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: e6gp8tewyg8hwgxfirymnq88h4wwz8o3 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: C2FFD4001C X-Rspam-User: X-HE-Tag: 1701182951-403246 X-HE-Meta: U2FsdGVkX18b5wAOPY/PgJOfWBXQ1apvW4xLGzlTYr03GjEzPhFUl8TGZ9DVkg4OQQHWTUIu3T9L0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+WIUfVBpOAoWUHqP031KIZI+VsZy1rUYBONC//zU1IwLgmYXtMZwEINVlDfe30VbeQHTZts7xTz7T0iq6BxbFpxyIlnI3X9jr8WJtU/LpqUofvqW8= 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: [restoring the CC list as I believe this was not meant to be a private response] On Tue 28-11-23 09:12:35, Gregory Price wrote: > On Tue, Nov 28, 2023 at 03:07:28PM +0100, Michal Hocko wrote: > > On Wed 22-11-23 16:11:53, Gregory Price wrote: > > [...] > > > @@ -928,7 +929,16 @@ static long do_get_mempolicy(int *policy, nodemask_t *nmask, > > > * vma/shared policy at addr is NULL. We > > > * want to return MPOL_DEFAULT in this case. > > > */ > > > - mm = current->mm; > > > + if (task == current) { > > > + /* > > > + * original behavior allows a kernel task changing its > > > + * own policy to avoid the condition in get_task_mm, > > > + * so we'll directly access > > > + */ > > > + mm = task->mm; > > > + mmget(mm); > > > > Do we actually have any kernel thread that would call this? Does it > > actually make sense to support? > > > > This was changed in the upcoming v2 by using the pidfd interface for > referencing both the task and the mm, so this code is a bit dead. OK, that is the right thing to do IMHO. Allowing modifications on memory policies on borrowed mms sounds rather weird and if we do not have any actual usecases that would require that support then I would rather not open that possibility at all. -- Michal Hocko SUSE Labs