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 4D4A1C54E41 for ; Wed, 6 Mar 2024 08:45:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF8C86B0075; Wed, 6 Mar 2024 03:45:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AA7936B007D; Wed, 6 Mar 2024 03:45:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 947C76B007E; Wed, 6 Mar 2024 03:45:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 80A8C6B0075 for ; Wed, 6 Mar 2024 03:45:21 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 37F1180A94 for ; Wed, 6 Mar 2024 08:45:21 +0000 (UTC) X-FDA: 81865980042.08.F8571C2 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf01.hostedemail.com (Postfix) with ESMTP id 227BA40006 for ; Wed, 6 Mar 2024 08:45:18 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=2RDm71qY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UCLBWCjz; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=2RDm71qY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UCLBWCjz; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf01.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709714719; 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=5hNv5uA53bbnjTxhxZxB4EFwSuZ+2wclxh0E1t2ykxk=; b=08WbHlJSPp4J/Eu2X5Enjdnl/OiKLoedUAY/Z/hMpC6ERppIlqXAuXrnVuT5YlrVNcajKb wd30cVO3tG3M00JbT0H3wIlcw7nezTGnaF6eFmzypXsfc5/phkcWh9QUaNgtCuShev25Gb Hg5P+qIFX8MoI5AawtpYzosa37D1IEU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=2RDm71qY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UCLBWCjz; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=2RDm71qY; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UCLBWCjz; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf01.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709714719; a=rsa-sha256; cv=none; b=3y8ATYBUQ+RPqm3HCfB6HLi5mEamX+3Y7y2QuShPLHro0qJ9LERAHVrqtpvhDzoug8pZc9 Qwp0oP5WepMYeF1nggJFopDXQwnPjvwFKwPclDPj1XiTeJs4GcMR6BqxU4nsf2nLg0EGJk EV5KyXx2pa8w2w3oxtbf6l8b2ja7GPQ= Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [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-out1.suse.de (Postfix) with ESMTPS id 5F29E21A20; Wed, 6 Mar 2024 08:45:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709714717; 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=5hNv5uA53bbnjTxhxZxB4EFwSuZ+2wclxh0E1t2ykxk=; b=2RDm71qYwUcCfefhb6/vy0hJdvWvBABcNFuJtMlHjtTXiuap3GoceJ/+ifKT032LDobxN0 XlN+6I0mAigzbHc/XJenRpZK3NmxPC7voTVEcGjizktbeOu4ZHzhSwRQEX/NCPpAW2hQqd SU+UHLzjP0jXPJFp/RACk5ZMTwAH3uU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709714717; 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=5hNv5uA53bbnjTxhxZxB4EFwSuZ+2wclxh0E1t2ykxk=; b=UCLBWCjzoVX1/ktiAgZfLWEybwS22JtC7bn3pqwzU2q305aQ3JcN+mlIEg8l8AeS53D1xp yrrP0NLLzHfLVtCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709714717; 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=5hNv5uA53bbnjTxhxZxB4EFwSuZ+2wclxh0E1t2ykxk=; b=2RDm71qYwUcCfefhb6/vy0hJdvWvBABcNFuJtMlHjtTXiuap3GoceJ/+ifKT032LDobxN0 XlN+6I0mAigzbHc/XJenRpZK3NmxPC7voTVEcGjizktbeOu4ZHzhSwRQEX/NCPpAW2hQqd SU+UHLzjP0jXPJFp/RACk5ZMTwAH3uU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709714717; 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=5hNv5uA53bbnjTxhxZxB4EFwSuZ+2wclxh0E1t2ykxk=; b=UCLBWCjzoVX1/ktiAgZfLWEybwS22JtC7bn3pqwzU2q305aQ3JcN+mlIEg8l8AeS53D1xp yrrP0NLLzHfLVtCg== 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 CD43F1377D; Wed, 6 Mar 2024 08:45:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id ctcPLxwt6GVjGwAAn2gu4w (envelope-from ); Wed, 06 Mar 2024 08:45:16 +0000 Date: Wed, 6 Mar 2024 09:46:35 +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: [PATCH 2/3] mm: hugetlb: make the hugetlb migration strategy consistent Message-ID: References: <8d35b8ae-b8d8-4237-bfcf-ed63c0bb4223@linux.alibaba.com> <3eda72bd-25ad-4518-b38e-b63f75e5e94d@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3eda72bd-25ad-4518-b38e-b63f75e5e94d@linux.alibaba.com> X-Rspam-User: X-Stat-Signature: ckkf4s7dy3ig58f9amuczyas54p86iw9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 227BA40006 X-HE-Tag: 1709714718-306338 X-HE-Meta: U2FsdGVkX18OkeavRFvlJe3pazp59oS4XqxpIqqM+NTXOmaDBJ5tAEidsdzlU9lHTjayJ7V5f0Sb/2LebBgIzh5+m9WRNmyVATxqGyIxZU0CZyedEodm41v/4mVluu+5XlM3JS3X9ZGFPe6Sfm4ssSQzeumtz/oi5DLnEQ0lbi2D+w5V1YQBSu5T2eQ5Vs2ILMrPeD4XoysOP3DfFjQEhqYM5MMvO+e1iwwtnftRyuuKq2826qxBHtv8KUiOAnrFrIJ/iPZR9qIuRB3b+CeuI1j367pdZLj9VmnYFjwtQWo75OCMc7w2sBYN3CUW3shdgmaxoHMs+X3nrlKGLA/u/eTsqGY5SXdgAlDMazT6Ps5KSDBA2oiZ+x0hYRf8G3LPu6T3/ftA/QDh0o6f5vgTAp3CZspaoqZ0X4++AkwwuUtbSq/EM0fJVwnaIzpw5bfAXKpxApHnZ1nec9oYJk2GDYuESVaKTnwfqOJXnW+FrVnS7tMjNqF8nrkRMUsOkYCLp+I4jst7a6Qfx9BMOubavUZu8Wk6NXPWnN84llj5sxRv0r8OJnGC1HsOJTYz0fqboUHHp/m2f+ItD4GoycC/BkrwUI1npeURvZIRwN8XBsl1WAtM3D9sW3JvEmkD6CcgtxZC7VU5y/SPALwCIWQXfG6u2UYbHzhALG6Nrc/eRseAkWw+BLHb5++1+DAqkA0aAZedQYWInvltUUFpXPe72qol9zRfxf9UzBI+uJ6uHWSstnC+ovox7ICR8kFBsiWb7kiv6ITa6GlpTR19Iew+SzV+495K0Dj+Pjl1nT0184bLo04/ueXVAlgZ9GyXMSlNVUdw04j1fMqEESPdK3/AbaoiBHEMSs4fmBcl6+p+qzwx00DbWQ6EAY0CCmtSCMEp X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, 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 Wed, Mar 06, 2024 at 04:35:26PM +0800, Baolin Wang wrote: > On 2024/2/28 16:41, Oscar Salvador wrote: > > if (folio_test_hugetlb(src)) { > > struct hstate *h = folio_hstate(src); > > + bool allow_fallback = false; > > + > > + if ((1UL << reason) & HTLB_ALLOW_FALLBACK) > > + allow_fallback = true; > > IMHO, users also should not be aware of these hugetlb logics. Note that what I wrote there was ugly, because it was just a PoC. It could be a helper e.g: if (hugetlb_reason_allow_alloc_fallback(reason)) (or whatever) allow_fallback_alloc = true > > > > gfp_mask = htlb_modify_alloc_mask(h, gfp_mask); > > return alloc_hugetlb_folio_nodemask(h, nid, > > - mtc->nmask, gfp_mask); > > + mtc->nmask, gfp_mask, > > + allow_fallback); > > 'allow_fallback' can be confusing, that means it is 'allow_fallback' for a > new temporary hugetlb allocation, but not 'allow_fallback' for an available > hugetlb allocation in alloc_hugetlb_folio_nodemask(). Well, you can pick "alloc_fallback_on_alloc" which is more descriptive I guess. Bottomline line is that I do not think that choosing to allow fallbacking or not here is spreading more logic than having the htlb_modify_alloc_mask() here and not directly in alloc_hugetlb_folio_nodemask(). As I said, code-wise looks fine, it is just that having to pass the 'reason' all the way down and making the decision there makes me go "meh..". -- Oscar Salvador SUSE Labs