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 49598C19F28 for ; Wed, 3 Aug 2022 12:56:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 918378E0001; Wed, 3 Aug 2022 08:56:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A0AE6B0072; Wed, 3 Aug 2022 08:56:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7418D8E0001; Wed, 3 Aug 2022 08:56:47 -0400 (EDT) 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 60DEF6B0071 for ; Wed, 3 Aug 2022 08:56:47 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 391551A14C9 for ; Wed, 3 Aug 2022 12:56:47 +0000 (UTC) X-FDA: 79758280854.06.CE29CAC Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf13.hostedemail.com (Postfix) with ESMTP id B24DB2011F for ; Wed, 3 Aug 2022 12:56:46 +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-out1.suse.de (Postfix) with ESMTPS id 1C7304D53C; Wed, 3 Aug 2022 12:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1659531405; 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=VBjG8dobIZkku1CWQkR/K9igC2Gpo0t0c8G7EPf8X8M=; b=V0weYV7JGTmeNz+1PQTWXbPhLVwOzwSmgj9cw1QTp/LuCKl9ek5J9/LRFtGh9pnj+bQ71I Ilq0+Q22P68fXmKnVfhFuIdP9FFoh2S9uN6V/dYZVEVrtBGmtOQLdsP/xh6eU8IQngbLcY 6E2U8fvdpFgvtryeHmh98daEEwklPsY= 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 EF84813AD8; Wed, 3 Aug 2022 12:56:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xiMdOIxw6mKNbgAAMHmgww (envelope-from ); Wed, 03 Aug 2022 12:56:44 +0000 Date: Wed, 3 Aug 2022 14:56:44 +0200 From: Michal Hocko To: Feng Tang Cc: Muchun Song , "akpm@linux-foundation.org" , "bwidawsk@kernel.org" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Mike Kravetz Subject: Re: [PATCH] mm: mempolicy: fix policy_nodemask() for MPOL_PREFERRED_MANY case Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659531406; 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=VBjG8dobIZkku1CWQkR/K9igC2Gpo0t0c8G7EPf8X8M=; b=4eftfD8HCehH0K5hpsFvLs1t7foUqzK49A2ZCMaESJP4EAkQhMvdUNGcqBsTqqI21rd8Uk sZ04BMwzOlg0ukD8atHwTxoy71nhrDyJ3kdT5M93u88wEwpvPSxQlMhqExopzQ/qiXcNl2 04N8CpACPJHl5ekqdWrWxQZwF/HIIPU= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=V0weYV7J; spf=pass (imf13.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659531406; a=rsa-sha256; cv=none; b=mEiU17fjUUl6Ls12sjVqAzP7nxBd+H79EuhvmTg7g2bW4gpHwlgO3swlt2oyhjKMr6lNHm /YZ7xIEsB9XN0eR0pzWkP9p/QiDSWt7mtTJoMfPS0Vq1yLlCU7TGD3Kw9e7jdYzwOD9DqV 3dxR0YcsQuvhoAB6stLYmoy5SW5PVrs= X-Stat-Signature: bqgyimak13zgkkzpi6abxjb13n5js88a X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B24DB2011F Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=V0weYV7J; spf=pass (imf13.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-HE-Tag: 1659531406-773010 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 Thu 04-08-22 04:43:06, Feng Tang wrote: > On Wed, Aug 03, 2022 at 07:28:59PM +0800, Michal Hocko wrote: [...] > > +struct mempolicy *policy_mbind_nodemask(gfp_t gfp) > > +{ > > +#ifdef CONFIG_MEMPOLICY > > + struct mempolicy *mpol = get_task_policy(current); > > + > > + /* > > + * only enforce MBIND which overlaps with cpuset policy (from policy_nodemask) > > + * specifically for hugetlb case > > + */ > > + if (mpol->mode == MPOL_BIND && > > + (apply_policy_zone(mpol, gfp_zone(gfp)) && > > + cpuset_nodemask_valid_mems_allowed(&policy->nodes)) > > + return &mpol->nodes; > > +#endif > > + return NULL; > > I saw the logic is not changed, and it confused me that if there is > no qualified node, it will still return NULL which effectively equals > node_states[N_MEMORY], while I think it should return a all zero > nodemasks. This is a separate thing and I have to admit that the existing code is rather non-intuitive or even broken. I guess we do not care all that much because MBIND with completely non-overlapping cpusets is just a broken configuration. I am not sure this case is interesting or even supported. -- Michal Hocko SUSE Labs