Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp623291rdb; Thu, 22 Feb 2024 14:14:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUqqdFWXJbVbcUg7CRQh9yfgkknEPTKyrHPy3wJ4W3W60ShjUYOUt6BxZcUSR09n0YdaYzUctd1pbHMoiVuYyflqidiDhDAD/2krAuINA== X-Google-Smtp-Source: AGHT+IFzboa0hd2jOpYSYaYH1jHyfR6yvNtXsXnQ6qf9AqkVveSuDZnbsRwbwkjORAygYetq8Qne X-Received: by 2002:a0c:f38c:0:b0:68f:2e24:615a with SMTP id i12-20020a0cf38c000000b0068f2e24615amr511104qvk.12.1708640087225; Thu, 22 Feb 2024 14:14:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708640087; cv=pass; d=google.com; s=arc-20160816; b=XtVBAK5nxEolLeizPZyiPmg2rtjraYPh4xA8zOqBmXrK58zYV5jomsagSv90ARHjQS L0w5orcjJ4snlboIobEq1Mmo2jfaml5Xp/qVGz5ZgZ4gDJDAAtWhmOQVz3T8+6dylKBA 5E67MnI5YqJNqL7d+Ml0A7INr6Sh14VETxiyoIzWgFodOJiAsYdBP/t+ARL6s/6xqH/g qGaHq3grdvIyHDya6rFEdy4XQUgZAyI9uLm/23LSAL+6Tr99u/gTXpzzqSPPe7ZBDPSH dDZa+BuGiGg3ORYBjqmNLzQCZJFEsqEDgnEGan4rP2SCSNJhM/6VnU9u/bLc8dsMmFlp PpUA== 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=s3x1kXri66JyHJOjJiePnNdMjnDBmEbBOnkticzR0VQ=; fh=29kF3k1G5XnfnvBx80C0WmNjEVW4PA3+/HN+wTUqsak=; b=yp3Pyh38+wDDKCMe69jRc+ss5zqPcwS8e4Af3HKLr/idr/U3NAxqo5Uw6egr/yZlqR ahMiWZBg+B9g8Fu9DdL1hqaSFp4AxV5WExiUvKPPsR9ScBYpqDtYeM0DRCZOVkfFEvlA DnvmYGC8oOjyYDTVSexhUpszYjlyEbJdS4GHzt15wU0c1RvkB5g2TkHNMDGkNew/Ndfy KgHj7FiSVi/diR2w99QNXStQx6dMf5SbruJnjowUZd3vHQMirNfzLTw/+8mZct0vUs+H bbntkgo387a1MyI5zhZgfbv575XBBMUocvdZ6WCmHws7MT8HJHMVzXV5c1IW4ebpAf4j d0HQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=S+AOktY+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=S+AOktY+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="/wOuXm+Z"; 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-77454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 15-20020a0562140d0f00b0068fcc0d280bsi1350583qvh.208.2024.02.22.14.14.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 14:14:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=S+AOktY+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=S+AOktY+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="/wOuXm+Z"; 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-77454-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77454-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DEE381C243E3 for ; Thu, 22 Feb 2024 22:14:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 660A312D1EC; Thu, 22 Feb 2024 22:14:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="S+AOktY+"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/wOuXm+Z"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="S+AOktY+"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="/wOuXm+Z" 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 A9FD373F10 for ; Thu, 22 Feb 2024 22:14:34 +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=1708640076; cv=none; b=AVWxWewg9FdUMJCDQc1Im7z8XHFS21WmIl+/ozQFmM9WG0UImkYfKYLMUeOlL9eTK1+0zyJxXm5Uqp+Q2VEq6S2HwsBVIjRznd686To5W+BRoITLdKk3K0u+s4o7+l8xI/hkEhxhrUfwHRTyQB81HxeaaQSdViqVaebumDM8RF8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708640076; c=relaxed/simple; bh=CCWvmYyAAfCjtNJbIiOfHLAVoscoYeZZ2nmAaa5xvjM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XTK7qb8ofAzY7STKbPkMlJ7H/oMQM0wG4OelgJQNvyvTznUc+0U8YuA+skp1VCclolxhXoofocMPj/kWOecHpwLrgzAAB8ZARS7PAH9M4QPUaTgwh3dpDXd1+ZtR9GozLbE+4W4zOB0dc5pQJdvsvjs+Nec3Iwldg/tdzbW5Lv0= 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=S+AOktY+; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=/wOuXm+Z; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=S+AOktY+; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=/wOuXm+Z; 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 9A9AB1F799; Thu, 22 Feb 2024 22:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708640072; 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=s3x1kXri66JyHJOjJiePnNdMjnDBmEbBOnkticzR0VQ=; b=S+AOktY+cQNOIwM2Du5uSUZhxwzrPjB1rlMQoamhOh4z18lJYbtQXVkN3jzxUA+igqzIC5 vap7UwdO0tEiomvKHCuyIln14POsKalV86LWQZt5Ut7dJeOyBI9zOogE43ZRQSZaTz0b57 qvMZXY9Vw77O/EYQ+vXNettiumsvOcc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708640072; 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=s3x1kXri66JyHJOjJiePnNdMjnDBmEbBOnkticzR0VQ=; b=/wOuXm+ZPVGVBWhE923F8HxmuuKJeAvFCntErDyRom5JpHFxn75bYH+8LmpKz40lzjRcjZ sE16Fb/Bx5OFAhAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708640072; 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=s3x1kXri66JyHJOjJiePnNdMjnDBmEbBOnkticzR0VQ=; b=S+AOktY+cQNOIwM2Du5uSUZhxwzrPjB1rlMQoamhOh4z18lJYbtQXVkN3jzxUA+igqzIC5 vap7UwdO0tEiomvKHCuyIln14POsKalV86LWQZt5Ut7dJeOyBI9zOogE43ZRQSZaTz0b57 qvMZXY9Vw77O/EYQ+vXNettiumsvOcc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708640072; 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=s3x1kXri66JyHJOjJiePnNdMjnDBmEbBOnkticzR0VQ=; b=/wOuXm+ZPVGVBWhE923F8HxmuuKJeAvFCntErDyRom5JpHFxn75bYH+8LmpKz40lzjRcjZ sE16Fb/Bx5OFAhAQ== 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 1608113A6B; Thu, 22 Feb 2024 22:14:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id liI/AkjH12XxQQAAn2gu4w (envelope-from ); Thu, 22 Feb 2024 22:14:32 +0000 Date: Thu, 22 Feb 2024 23:15:39 +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> 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: <0514e5139b17ecf3cd9e09d86c93e586c56688dc.1708507022.git.baolin.wang@linux.alibaba.com> Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=S+AOktY+; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/wOuXm+Z" X-Spamd-Result: default: False [-2.96 / 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]; 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]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.65)[98.45%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 9A9AB1F799 X-Spam-Level: X-Spam-Score: -2.96 X-Spam-Flag: NO On Wed, Feb 21, 2024 at 05:27:54PM +0800, Baolin Wang wrote: > Based on the analysis of the various scenarios above, determine whether fallback is > permitted according to the migration reason in alloc_hugetlb_folio_nodemask(). Hi Baolin, The high level reasoning makes sense to me, taking a step back and thinking about all cases and possible outcomes makes sense to me. I plan to look closer, but I something that caught my eye: > } > spin_unlock_irq(&hugetlb_lock); > > + if (gfp_mask & __GFP_THISNODE) > + goto alloc_new; > + > + /* > + * Note: the memory offline, memory failure and migration syscalls can break > + * the per-node hugetlb pool. Other cases can not allocate new hugetlb on > + * other nodes. > + */ > + switch (reason) { > + case MR_MEMORY_HOTPLUG: > + case MR_MEMORY_FAILURE: > + case MR_SYSCALL: > + case MR_MEMPOLICY_MBIND: > + allowed_fallback = true; > + break; > + default: > + break; > + } > + > + if (!allowed_fallback) > + gfp_mask |= __GFP_THISNODE; I think it would be better if instead of fiddling with gfp here, have htlb_alloc_mask() have a second argument with the MR_reason, do the switch there and enable GFP_THISNODE. Then alloc_hugetlb_folio_nodemask() would already get the right mask. I think that that might be more clear as it gets encapsulated in the function that directly gives us the gfp. Does that makes sense? -- Oscar Salvador SUSE Labs