Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3898271rdh; Tue, 28 Nov 2023 06:49:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTFbnJh5fxwn7E5TsLamRYDbX/ty+mLqmX+Ci1MxsSuIWRnaLIsJ2c2dIT731Y/baNBbWi X-Received: by 2002:a17:90b:1b43:b0:285:b08a:971a with SMTP id nv3-20020a17090b1b4300b00285b08a971amr11792140pjb.29.1701182975548; Tue, 28 Nov 2023 06:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701182975; cv=none; d=google.com; s=arc-20160816; b=sgjDEvo9rKb80hwvMxkEHtsgeNFz43y6c5S74w4NCVV0F2xwbHTJekW9DTjhxEH/Mi Li0gauA1utSGgFgGAb9yQuN5MOoKRbLnDXfoaby0AmGXf/05yKzgXJ8AeqSE49jY5Gpl bxQsruQM4o5pYC7wFZGPK59Wb/lzd6MTO3VX0ubL83wEXr/23ui10luz2wNI79/AnJj+ 84yr9AHq8AiRX+/za8YZEbn7deGuAxG+kibPTS9db+Fgu+gBWUZ2Bzk61PZ5zs4pJi1q Iv3r1NyFnIpzY02QpKYR/LXJ2lwbAe55uYPa87vNuyq8wanKdSzwUZp6xjMgz1dyc6Qr HG3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AGmTk8emchkRnIZ9vc9YqHrdZi2kThKUDQIAuz1Uolw=; fh=kOSFhAZysTpNV05s41JhBueJwKVutHJj+nrp1AEtbTM=; b=vgVGJbyk9kzWnacFkhySDnQmDL3iF6g183w/W95HAgT3/B6/6HW8Iv8kjztddA8kKf 39Zv2Kgz3gy+KP3da1phZItfgwXBwTyy6mu3GeFnHv2t8TCOMNvPkf05jFXh2zmw84Ub 89iw+3iAT9r9hw+I3KSmZ5tcccILKDHotSwN6egYqSD7oGEKMyHipbq1FumSUHjkpRdr DAhHk68r1o5a8pdVe/Pwaj/4XkT3W8EedS32adT38sTCxfA2GP95NLWjDiO/s/wKFoWA gG8mV62I1r/Jq0FoqDfIr20VxayFYuIl6wM10sSw+hQ4lRWKJK1EaaGCm8tV2mFe/VZB 5WdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=mBdDZcd9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l4-20020a17090ac58400b0027d30e575ccsi12355738pjt.115.2023.11.28.06.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 06:49:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=mBdDZcd9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5250A80A531E; Tue, 28 Nov 2023 06:49:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346330AbjK1OtH (ORCPT + 99 others); Tue, 28 Nov 2023 09:49:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346317AbjK1OtG (ORCPT ); Tue, 28 Nov 2023 09:49:06 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 728F7AA; Tue, 28 Nov 2023 06:49:11 -0800 (PST) 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: Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spamd-Result: default: False [-0.80 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-0.992]; RCPT_COUNT_TWELVE(0.00)[19]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[24.72%] X-Spam-Score: -0.80 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 06:49:32 -0800 (PST) [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