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 E60A0C48BF8 for ; Mon, 19 Feb 2024 19:12:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BE4E6B0074; Mon, 19 Feb 2024 14:12:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 06EA26B0078; Mon, 19 Feb 2024 14:12:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E78846B007B; Mon, 19 Feb 2024 14:12:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D73646B0074 for ; Mon, 19 Feb 2024 14:12:32 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 727BFA066F for ; Mon, 19 Feb 2024 19:12:32 +0000 (UTC) X-FDA: 81809499744.30.975B095 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf30.hostedemail.com (Postfix) with ESMTP id 2A5CA80012 for ; Mon, 19 Feb 2024 19:12:29 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=fealQsEe; dkim=pass header.d=suse.com header.s=susede1 header.b=fealQsEe; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf30.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.130 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=1708369950; 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=aMpEL2+e85GACA8bPRrOyB3E//c1GtaW/ql4XdXJNTs=; b=KVd+gvybt0RqdiZWRTAYxuEn/rLaGF027qe4AwSkOlxrRzb66rVRUWChLBq2oVZqoI9hCN L2BOd0vjavS63ZrJBIBwH/JNBkGhxuA4to/aAaRxona7h/OU0ABLpesfiD8bmShe0SycwT yboYPJGushR9v87iJi/Q4PJoVN+cS5o= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=fealQsEe; dkim=pass header.d=suse.com header.s=susede1 header.b=fealQsEe; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf30.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708369950; a=rsa-sha256; cv=none; b=4Z5FyUiWd6cTuukvxjKcrtZqjKiTdjcxbWJ/e3s5XFKkeRTqBxD2MliTrn3CYWb6u4ODWB yKhhcyV2jNZfZv26aksXI82yUfzRe3oHj0sl7UmM1tauA1xDE3blZ0gsU8PRCzrobz8zj9 wMAuufWOVcioTim7L+5ugJ6bYSi6Qdc= 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-out1.suse.de (Postfix) with ESMTPS id 23CA422169; Mon, 19 Feb 2024 19:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708369948; 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=aMpEL2+e85GACA8bPRrOyB3E//c1GtaW/ql4XdXJNTs=; b=fealQsEeDhpJ42fpCFwqBjdw9eb9w++4RjoZChVaanOe5J6ic2qShPqXJ4SW/JWn4/iE4o U68mQ/XEf7sK553VpIQR5uJmZYTIahlXNyd9SicU/k0vhaIFKfLl4rmKOzNH/QLAfSWkPb P9nAdSppC/VuPfKi4zzP2U21N1OBRTg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708369948; 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=aMpEL2+e85GACA8bPRrOyB3E//c1GtaW/ql4XdXJNTs=; b=fealQsEeDhpJ42fpCFwqBjdw9eb9w++4RjoZChVaanOe5J6ic2qShPqXJ4SW/JWn4/iE4o U68mQ/XEf7sK553VpIQR5uJmZYTIahlXNyd9SicU/k0vhaIFKfLl4rmKOzNH/QLAfSWkPb P9nAdSppC/VuPfKi4zzP2U21N1OBRTg= 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 02CA113647; Mon, 19 Feb 2024 19:12:27 +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 rRzfORuo02XEJwAAD6G6ig (envelope-from ); Mon, 19 Feb 2024 19:12:27 +0000 Date: Mon, 19 Feb 2024 20:12:23 +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> <25b420aa-3fe6-40a4-8d60-a46ab61ee7b7@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25b420aa-3fe6-40a4-8d60-a46ab61ee7b7@linux.ibm.com> X-Rspamd-Queue-Id: 2A5CA80012 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ip96a5aarucb7owgfmmdr6xnjni9nmkt X-HE-Tag: 1708369949-519214 X-HE-Meta: U2FsdGVkX19xoJ6YpKS8Lyf7FAnsn4qiRlJZrVuf84gZDwmcY5dfQl7UCgDtHDV9aVHGkqB/+ljwnDk4h3eYNi4jiHaARkl4NwqNQqyx7ADT/zKyU1RKxteELLronCJrDYvqrY63kKti+VR9OvZlzWC6xC6l+euZFL4xx6bgDpGS4roTN6J4OG4XCXLRZy2y+3OUGfMYYNs7LBNOooDDMm0sYCTLANPXjvXBzThIyijVn4i+hfR0B9av45IYyrqBmlkS56ByhSDkNEGa0fQQtk8gcQgao092Kyz/SLU+G/04E+D5WaNK/U75+oxhUP/NWMKqVsVuM5bUsuKB5Nx0nV5//T8M7Is/tcfP9Yl70C6RltUUU/iuzXK+PPwQ913ekHfxSFTs0BEdGLuGvdJAw0uPpdUalLa5AA2qMdTTE6VQSUWG5zj9D4wHC7M/WESxP82LABGSGutLgbsJ1lIX/BtL1fyCFkWc6IBaohkqMcJymXkQAIE+j/pU/JXsMdga0oFkAcG3F38QBWd7PfYZcSo15UuZj95LgD9IfIonXkuAU10ePkuc9wACldfNc7VLZo3ESWiwPeHjzU+6R3N/pqD8s+sBT457wR+tf82vFvUNm7il5joFPG5iqPxKvvKomPO1qBgPBIX51ScYWrBjUzcl3mfTQerrIUuFh4ROFqFjr00V/LtWkHfX4A1R6HfWyVnmVQ5Tck3mfjdBtkmIofgl0eqApuqn8nbQXemqqGDJc43UySPSLXR2+3ZkoV0d8MuH2c8lYxW4FvdA7UKtBXl6fe+gJ9dYXDrgoR0lHd8blq1yGmDrH11Z4+NkJt6CYZ15leAZz8onnPpzhnDCXG8H2U/j5yvo8RZmRje0CyVUuBSrkZ0UYHgCbTdWKgZXmuYoQyHXv1DWWbBCn2/eQjwA1jz3eJhhzMaA7I3H1EafmPbmvfWcRaOfnWo8tpnrGYqbh+YIqYVZDriZtho xcxeltvw H+Mynt3l+3PU+9dhsRP34GQxnMWkVdyt/TtPNbMnqPQxWOTMKqvJYedl2PMjVS62CSroGctfopHfQVFN4UradBfkgwPRkDLineIBB/rEwKXRy1qWZgc95BCKUxT4KSS7mx5LgigysnPZqNR8JITJoOSepIXv2CWROnu8eJDpfRGnJlPQyWws+CcmpJ3BBpm/cXIf9tpD6q5V0HZOG4dQrtT+yhNaLXSHsh8A7fSi47YOML9NqB8CDXZb7juxe+gS9cIz7bfgEGWYAPkk= 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: On Mon 19-02-24 20:37:17, Donet Tom wrote: > > On 2/19/24 19:50, Michal Hocko wrote: > > 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? > > With this patch it will take full nodemask and find out the correct migration target. It will not collapse into first node. Correct me if I am wrong, but mpol_misplaced will return the first node of the preffered node mask and then migrate_misplaced_folio would use it as a target node for alloc_misplaced_dst_folio which performs __GFP_THISNODE allocation so it won't fall back to a different node. -- Michal Hocko SUSE Labs