Received: by 2002:a05:7208:3188:b0:7e:5202:c8b4 with SMTP id r8csp874486rbd; Fri, 23 Feb 2024 06:20:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWhULw60f3+TGb36tvBbJuvW/JKvnoQneS7+imqqr356OOVHvdIX900ppu6ZrMc5Vz3y3bXiagg9fwBcLktv0Hdj51QxxeTDq8/Tdlttg== X-Google-Smtp-Source: AGHT+IGsEwxXNoEDmEm67d5PP4VkpL48+GmBlT+rK/w+BXZXo/BcY/lIaUWbpgU0WW4ewg0gJyfv X-Received: by 2002:a17:90a:5910:b0:299:489f:a126 with SMTP id k16-20020a17090a591000b00299489fa126mr1499765pji.41.1708698023524; Fri, 23 Feb 2024 06:20:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708698023; cv=pass; d=google.com; s=arc-20160816; b=nb4CQpRtWfDS7mtompEMlwGP0MpowlVYagnFmL9YmOxcM9LrP55YafB1XXWyjm/yHh phDEbQm/YyLtt5vlp+5wZZFwLc3uXuTXioNEwkqsSRgu4uXlwDD/kt1qLvRfioWGbwxi YhNsDofTXtuZbd4tyZ/lCdjFEWoxuUE+vQQgfxo9iwIUtsfQRY5K4CgxUeS4xdwT0RjF GcgJpbW9OfKcH2cVkSZ73zMA3+7tIA2OETxUl7BLV2fXMNZG7c0rJFstpdKjnCABRUA7 uJBCvG+u92qOBuScTXRpFaL/Gz7GMYkhRx5n+SUVZLaL48wehGL0lVS5PIlM31tyvn9C GoqQ== 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:dkim-signature :dkim-signature; bh=8VyCyrehk3lZ9bYzoHMAHHn/3gFCXmGPk7/GfakXrfk=; fh=29kF3k1G5XnfnvBx80C0WmNjEVW4PA3+/HN+wTUqsak=; b=miljxDo+uVZHbOxLeociBTdYRrZpTykdg8ZrqXWHiBxtjPYXvSkPIhJRgxcNanZy/a Ly9U42bLyYVlVqlrIJD0DsQnsaoG7rPpuwSgYxCb9BAd3BooFaD012k2Yq+ZMYlkFTRl ZEg3JZs8gqGJ0hnUGaOsA+4/FU01kdK2m2G3PVlausx+Ap1Bgl9xsn1ibRF2PLU18r3R +goM7t2ckqBU1eAgH2So1mFlbR1CP82EGrnP8dF1YOojZSC0eiSBy061vtqoDH525ois 55RFYTNbr7lxTpY4XRRh5TFwSPH10Gcke1NGinh9DO6wpdjagFlIFaY811Wpy9nn+dyN ga1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pp0fSthx; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pp0fSthx; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-78469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u15-20020a170903124f00b001d5f0ef1c8dsi12460675plh.167.2024.02.23.06.20.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 06:20:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pp0fSthx; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pp0fSthx; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-78469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 33B8128185F for ; Fri, 23 Feb 2024 14:20:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4920D823A7; Fri, 23 Feb 2024 14:18:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="pp0fSthx"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Z4J5cJgn"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="pp0fSthx"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Z4J5cJgn" 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 A208C81ACE for ; Fri, 23 Feb 2024 14:18:25 +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=1708697907; cv=none; b=ZRKfQ+tIYnoI0Fz6ujTo2BZekMfMXKy7lb39LqKT3tgBppaa5ReckJMi9ro6o5JzjGFX7AZluvnlojBJ5pHzrtgIIIIhfDBU5HL8gfozsVBRZBNUCuhArLLsdcg2/Z9KUCnKDPg8VAoQ0kSwbzycfsyKKg1GzYdYkE8IhT72cCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697907; c=relaxed/simple; bh=X3OwZlDhSXnIj5p2Ug690icelgyl5ae7KWaWNgRWoYQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YJb8XjWcc8HZV0H2dzEiTkhT5f8YDGefsyHdSFzP846+s6qO3k98Y78X3ZhGy6yL6iykWepX9ZasV/u+FdepxMvxQYWMFpamTvpO74pKhQWtxOc/K+rZw1IfY9+S7fRfUX6B8tP3h7V5LP2zpHPjUG+rVcw/xHSiTPhhHCK7zrc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=pp0fSthx; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Z4J5cJgn; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=pp0fSthx; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Z4J5cJgn; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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 9D6501F79C; Fri, 23 Feb 2024 14:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708697901; 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=8VyCyrehk3lZ9bYzoHMAHHn/3gFCXmGPk7/GfakXrfk=; b=pp0fSthx28CEEOlMVmHMrQR13brqM8WV1Bm5aD7XEDMR9l7qMVw74RcgVJxosTUJLDKY6j 3dmjZzwqoqNvfwENlk0X9pfI9yp7itbZq37v3nHlCGScDyPBE3UXHbEyRzdlEJrcnZd96M uGrTEbTpTk02S8q3fAoaXWQsZmEAI8k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708697901; 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=8VyCyrehk3lZ9bYzoHMAHHn/3gFCXmGPk7/GfakXrfk=; b=Z4J5cJgngz/PvFk5fbZFgoByw40vPGoW6iRmdkRtoJCpOQk0p/j157qqKMdB5XhuFvSPRC ZyaXVXE15yXBfhAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708697901; 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=8VyCyrehk3lZ9bYzoHMAHHn/3gFCXmGPk7/GfakXrfk=; b=pp0fSthx28CEEOlMVmHMrQR13brqM8WV1Bm5aD7XEDMR9l7qMVw74RcgVJxosTUJLDKY6j 3dmjZzwqoqNvfwENlk0X9pfI9yp7itbZq37v3nHlCGScDyPBE3UXHbEyRzdlEJrcnZd96M uGrTEbTpTk02S8q3fAoaXWQsZmEAI8k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708697901; 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=8VyCyrehk3lZ9bYzoHMAHHn/3gFCXmGPk7/GfakXrfk=; b=Z4J5cJgngz/PvFk5fbZFgoByw40vPGoW6iRmdkRtoJCpOQk0p/j157qqKMdB5XhuFvSPRC ZyaXVXE15yXBfhAg== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 11E8613419; Fri, 23 Feb 2024 14:18:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id GifuAC2p2GXwAwAAn2gu4w (envelope-from ); Fri, 23 Feb 2024 14:18:21 +0000 Date: Fri, 23 Feb 2024 15:19:34 +0100 From: Oscar Salvador To: Baolin Wang Cc: akpm@linux-foundation.org, muchun.song@linux.dev, david@redhat.com, linmiaohe@huawei.com, naoya.horiguchi@nec.com, mhocko@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 2/3] mm: hugetlb: make the hugetlb migration strategy consistent Message-ID: References: <0514e5139b17ecf3cd9e09d86c93e586c56688dc.1708507022.git.baolin.wang@linux.alibaba.com> <0a06dc7f-3a49-42ba-8221-0b4a3777ac0b@linux.alibaba.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: <0a06dc7f-3a49-42ba-8221-0b4a3777ac0b@linux.alibaba.com> Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=pp0fSthx; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Z4J5cJgn X-Spamd-Result: default: False [-4.31 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_LOW(-1.00)[suse.de:dkim]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[9]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 9D6501F79C X-Spam-Level: X-Spam-Score: -4.31 X-Spam-Flag: NO On Fri, Feb 23, 2024 at 10:56:48AM +0800, Baolin Wang wrote: > I previously considered passing the MR_reason argument to the > htlb_modify_alloc_mask(), which is only used by hugetlb migration. > But in alloc_hugetlb_folio_nodemask(), if there are available hugetlb on > other nodes, we should allow migrating, that will not break the per-node > hugetlb pool. > > That's why I just change the gfp_mask for allocating a new hguetlb when > migration, that can break the pool. Code-wise I think this is good, but I'm having some feelings about where filter out the mask. Ok, I'm trying to get my head around this. It's been a while since I looked into hugetlb code, so here we go. You mentioned that the only reason not to fiddle with gfp_mask before calling in alloc_hugetlb_folio_nodemask(), was that we might be able to find a hugetlb page in another node, and that that's ok because since all nodes remain with the same number of hugetlb pages, per-node pool doesn't get broken. Now, I see that dequeue_hugetlb_folio_nodemask() first tries to get the zonelist of the preferred node, and AFAICS, if it has !GFP_THISNODE, it should also get the zonelists of all other nodes, so we might fallback. In the hope of finding a way to be able to filter out in htlb_modify_alloc_mask(), I was trying to see whether we could skip GFP_THISNODE in dequeue_hugetlb_folio_nodemask() but no because we might end up dequeueing a hugetlb which sits in another node, while we really specified __GFP_THISNODE. The only way might be to somehow decouple dequeue_hugetlb_folio_nodemask() from alloc_hugetlb_folio_nodemask() and do some kind of gfp modification between the two calls. Another thing I dislike is the "-1" in alloc_hugetlb_folio_vma(). I think at least it deserves a comment like "Passing -1 will make us stick to GFP_THISNODE". Although that is another thing, we will pass "-1" which forces GFP_THISNODE when allocating a newly fresh hugetlb page, but in dequeue_hugetlb_folio_nodemask() we might get a page from a different node. That doesn't break per-node pool, but it is somehow odd? -- Oscar Salvador SUSE Labs