From nobody Fri Dec 19 10:45:35 2025 Received: from ssh248.corpemail.net (ssh248.corpemail.net [210.51.61.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1D3113C682 for ; Wed, 26 Mar 2025 03:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.51.61.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742958830; cv=none; b=PR46O3cSsMhaxyWPVZ9tbfvr2LnsDLi5Ol0IzRzPj1yGkY+agN4nBV9aRKC2wjuJFURYy5tuQkv6AbsNC5Q1d9j0tAcZDT91b6QwugO/VICq/IRv8cl8a49DDMHmwkktZTatJTfywMHGMtuY+lPR/zbWg1aMuyH41Fz/cL8/LlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742958830; c=relaxed/simple; bh=70vbRTzit+6BL+xOUjpuD0cSQSVS4Z1KKdbALHxhdvY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=SC/YZf7HkJp0tc+02fivxOspLWd5H7FeqAb+9Ix9EnWCy1emFEL3AvNtDMT4lDa5jXQfo+78dguIjgO/P27l3gbfnrxka2YP6tNppYjA4PdXd1Uk2gxOPwxDsj/89MQrny/yL13uElOO4a8U/N1R/RL/aZgmBC2qZhgkfN8EEHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=inspur.com; spf=pass smtp.mailfrom=inspur.com; arc=none smtp.client-ip=210.51.61.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=inspur.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inspur.com Received: from jtjnmail201605.home.langchao.com by ssh248.corpemail.net ((D)) with ASMTP (SSL) id 202503261112314780; Wed, 26 Mar 2025 11:12:31 +0800 Received: from localhost.localdomain (120.224.42.190) by jtjnmail201605.home.langchao.com (10.100.2.5) with Microsoft SMTP Server id 15.1.2507.39; Wed, 26 Mar 2025 11:12:31 +0800 From: wangchuanguo To: CC: , , , wangchuanguo Subject: [PATCH] mm: migrate: restore the nmask after successfully allocating on the target node Date: Wed, 26 Mar 2025 11:12:18 +0800 Message-ID: <20250326031218.487450-1-wangchuanguo@inspur.com> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable tUid: 2025326111231d56feec8dbe32f716dcd6ffc18fa9dce X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com Content-Type: text/plain; charset="utf-8" If memory is successfully allocated on the target node and the function directly returns without value restore for nmask, non-first migration operations in migrate_pages() by again label may ignore the nmask settings, thereby allowing new memory allocations for migration on any node. Signed-off-by: wangchuanguo --- mm/vmscan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index b620d74b0f66..9467b2acef28 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1026,8 +1026,10 @@ struct folio *alloc_migrate_folio(struct folio *src,= unsigned long private) mtc->nmask =3D NULL; mtc->gfp_mask |=3D __GFP_THISNODE; dst =3D alloc_migration_target(src, (unsigned long)mtc); - if (dst) + if (dst) { + mtc->nmask =3D allowed_mask; return dst; + } =20 mtc->gfp_mask &=3D ~__GFP_THISNODE; mtc->nmask =3D allowed_mask; --=20 2.39.3