Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1165735rdb; Mon, 19 Feb 2024 06:26:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQLMPyR6Dq/rcwBwEf/42gonKsa1JhXpiqvvTjYtkPeePbk7EXSfk0vkE4rCXmFNL5ct6UOx0DdS0ETe+52RxLX5oPUoQxOiQv4/swaQ== X-Google-Smtp-Source: AGHT+IEMcC7HEDyn9a0tlfPQgpiSDndXdXFZF53QCfO8ygFUdkZjIuVXILoOpAeQgvFNQ30UhIns X-Received: by 2002:a17:906:ca46:b0:a3e:9c7a:4ac2 with SMTP id jx6-20020a170906ca4600b00a3e9c7a4ac2mr2236882ejb.15.1708352787188; Mon, 19 Feb 2024 06:26:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708352787; cv=pass; d=google.com; s=arc-20160816; b=mjGjPJkzoNa85Vjdln7m1RvBcdfUA6m3aWpJKk0YMrcMqHkPVQIjVxrV4mWStyN5ft igGVb9Da+eUYxksXmr8ewEj9ZwiVagUgwERmubWyMZLkufBgA5bKkFOlWuFCtuP7uCsk HN4PSL2IM715RSepfUqRqcvVNLgBK7Toft4qM2VQz9ue+aA3PgSAwkqAx1s1MBuXXz9i QZw/0nFn311nq/n4fe9TRwSGDiGbsL3TvYgOG+0AGXaHyGibaUP8b5ResJkhaeopLLj1 mr6RkBxiIr//piATnQgc9exMxbPowLX5Zcr/blUZjTN58R6HZ92SsHmpcJGSTCh+x88f r2gA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=aLmOchcdO/OEdRe6+0EHgwuSqAEsd/dBHR41UH1V5cI=; fh=WkakfSRTR4mKy4g+2gNjJXvrEmYyI4aAcFIPyh+q7VA=; b=YSLSHPhhmUoZPby6EucQ6hCpAtK68ON4IrrcFMLrDPipB9eTWKmw5onXZm2cN/xpsA rpv972+dLuNbAAg9O8PDArpHgR8khh2g6d0OZG4Nths7O3HsDScyayLFCKbEOcXKlFeK O+644JJ8WvZwSRbLm+MchPSUFUQ7fVTTugp/s3HQ7/I5GyA+GgBthd+owNGYlVGPtpp/ t34JKXKQRWU3ArYeMC6As0UmHYAK2/RsJSLsYbDcmxWtK8px6+8Jmrz+BR4pX85aEsq3 U5aa5dNMm8rqXOgOGHJOLBhep25/q8Tiqz8J8zzWGmODfxPFy4XVeQov7n0k/D7Ecpb7 bPCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="D3jmGX/h"; dkim=pass header.i=@suse.com header.s=susede1 header.b="D3jmGX/h"; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-71469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u25-20020a17090657d900b00a3e461d5d2esi1849783ejr.456.2024.02.19.06.26.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 06:26:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="D3jmGX/h"; dkim=pass header.i=@suse.com header.s=susede1 header.b="D3jmGX/h"; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-71469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A23DA1F261C3 for ; Mon, 19 Feb 2024 14:20:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E7D5374F5; Mon, 19 Feb 2024 14:20:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="D3jmGX/h"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="D3jmGX/h" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AC0C374C4 for ; Mon, 19 Feb 2024 14:20:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708352421; cv=none; b=fO84gamTqI/4E8V3+RoRvO8X58LiWIevmpcDuQacNVK0N+AMWyS8foOAG3vXGYtBQF/0W6rlGsn9g/2fhwQY4NPJ12S0tn+fCX04jmyOuNr50MiUxgIkvo3pNuOIF41W2HhglSUO9K7IF8howuuVlUZV04eMUbsXVSD1Vmf8mdY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708352421; c=relaxed/simple; bh=ZUvNk1GfLc/6UZyzY9gUrJyxglgaYpHvQ6zevBMX+RM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dnLjhWXdw8jK3ljfoK+A4e7tztAORhnc9Mya2wtjn5k5nGnsYpjnzZbqR4/VzIdS/DOKmnUmGQ/el3525lqJwPa43cnr8rAt43w9a4HmyfXrwHgzUOKZsOxp+RUzlRh5fFpo8j9NgPvibzT7V5QJXd1v0frCpwQoknPBdwKhL4Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=D3jmGX/h; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=D3jmGX/h; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 933891F804; Mon, 19 Feb 2024 14:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708352417; 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=aLmOchcdO/OEdRe6+0EHgwuSqAEsd/dBHR41UH1V5cI=; b=D3jmGX/hc+ks0qDJM03xhBDKglvx0W7G+7BdI9Ud9eRlzRPU7XHzFWP0AMZbOo6/aFMgmr lvhlqqGNv+iCt9UEzRAwp8tQuWUkV6hiGHW+o61DuyLth1BaQ6XynAAgjVIyTHRvhJPDpD crn6pOsI4CEPJ09hNYZ7LagfXljH7Uk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708352417; 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=aLmOchcdO/OEdRe6+0EHgwuSqAEsd/dBHR41UH1V5cI=; b=D3jmGX/hc+ks0qDJM03xhBDKglvx0W7G+7BdI9Ud9eRlzRPU7XHzFWP0AMZbOo6/aFMgmr lvhlqqGNv+iCt9UEzRAwp8tQuWUkV6hiGHW+o61DuyLth1BaQ6XynAAgjVIyTHRvhJPDpD crn6pOsI4CEPJ09hNYZ7LagfXljH7Uk= 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 666E3139D0; Mon, 19 Feb 2024 14:20:17 +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 kZ55FqFj02UMXwAAD6G6ig (envelope-from ); Mon, 19 Feb 2024 14:20:17 +0000 Date: Mon, 19 Feb 2024 15:20:08 +0100 From: Michal Hocko To: Donet Tom Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Aneesh Kumar , Huang Ying , Dave Hansen , Mel Gorman , Ben Widawsky , Feng Tang , Andrea Arcangeli , Peter Zijlstra , Ingo Molnar , Rik van Riel , Johannes Weiner , Matthew Wilcox , Mike Kravetz , Vlastimil Babka , Dan Williams , Hugh Dickins , Kefeng Wang , Suren Baghdasaryan Subject: Re: [PATCH 3/3] mm/numa_balancing:Allow migrate on protnone reference with MPOL_PREFERRED_MANY policy Message-ID: References: <9c3f7b743477560d1c5b12b8c111a584a2cc92ee.1708097962.git.donettom@linux.ibm.com> <8d7737208bd24e754dc7a538a3f7f02de84f1f72.1708097962.git.donettom@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d7737208bd24e754dc7a538a3f7f02de84f1f72.1708097962.git.donettom@linux.ibm.com> Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b="D3jmGX/h" X-Spamd-Result: default: False [0.14 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_TWELVE(0.00)[22]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:dkim]; 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.05)[59.54%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: 0.14 X-Rspamd-Queue-Id: 933891F804 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Bar: / On Sat 17-02-24 01:31:35, Donet Tom wrote: [...] > +static inline bool mpol_preferred_should_numa_migrate(int exec_node, int folio_node, > + struct mempolicy *pol) > +{ > + /* if the executing node is in the policy node mask, migrate */ > + if (node_isset(exec_node, pol->nodes)) > + return true; > + > + /* If the folio node is in policy node mask, don't migrate */ > + if (node_isset(folio_node, pol->nodes)) > + return false; > + /* > + * both the folio node and executing node are outside the policy nodemask, > + * migrate as normal numa fault migration. > + */ > + return true; > +} I have looked at this again and only now noticed that this doesn't really work as one would expected. case MPOL_PREFERRED_MANY: /* * use current page if in policy nodemask, * else select nearest allowed node, if any. * If no allowed nodes, use current [!misplaced]. */ if (node_isset(curnid, pol->nodes)) goto out; z = first_zones_zonelist( node_zonelist(numa_node_id(), GFP_HIGHUSER), gfp_zone(GFP_HIGHUSER), &pol->nodes); polnid = zone_to_nid(z->zone); break; Will collapse the whole MPOL_PREFERRED_MANY nodemask into the first notde into that mask. Is that really what we want here? Shouldn't we use the full nodemask as the migration target? -- Michal Hocko SUSE Labs