From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 387AD23D281 for ; Thu, 12 Mar 2026 14:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773325632; cv=none; b=hcrAmzKmaAYK5MQvdVWEm/+UkSJCWJgcybCOKWvmbA+fHSLxRLBq7BkJAtn/GFj72waZwDOr9I8RGQLc4BypK5HlWZNwgnuaKsmK7PcMHrM2BnA5dVtmiuHzfXxwXyGbBG7yDb7gCvgvV6oY5gN2fNorwX6M9BYZaAla6G4ZSU0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773325632; c=relaxed/simple; bh=R3Nfe437IPcLYKUtej5Ptz8uCJW9O5V2AaB9eHj6kmQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=clVdoLjWoL/vg+JW5ZoSEFmb7DHUc1D1nw4vjbLZup4QYYYDlnnfkiSoi/NOc1fkAVWDwLXxVg8iovSBjd2/1+ljiY50/9LICUNpJgp1Gqn2IEeJbVYxMsj7AaT9VwJprFOCComKcPXANBwAJ/Ds66w5BQRm3PQrsDkiZr9Hjto= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=jIW1+VId; arc=none smtp.client-ip=209.85.222.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="jIW1+VId" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-8cd767d2d70so115561285a.3 for ; Thu, 12 Mar 2026 07:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1773325630; x=1773930430; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=abaAiQ/E4WeFRyf1X1ywTrn72K8d6oU3/W8FRhft/hs=; b=jIW1+VIdUxHU7IvwkYqnJJgIftW1um82ZgUqLAjqvrI/oAzfcvf+NUPZxj7/clFaAR vsb6BNWNx60OVmZFaMcmgksoa/AjNpC54+rOeyvxpeUTIt89RFmCHlgipNgWEqYr9hx5 f8epEXxGtKHYo3R+6tkW0w+smyABGjS3QzFCzha5/o8cvqUbFjlQVYOpqx37ZCHgX9BA eQY0SDRKLxURdpkZwUfC7cSW3OggxYhZkmxosuO0MKrp0KdhKOCLcxh1AJAFLPCACmtD fu5fmFTyVsClIEWvkV/OtQQARlmpN8RRDFS370M/TyyOchD8hitaP0A3Uc4hceuydyTk TcWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773325630; x=1773930430; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=abaAiQ/E4WeFRyf1X1ywTrn72K8d6oU3/W8FRhft/hs=; b=K8FTFAR6XbrTzjLBP5dQIAW1TYDdwPJvPiY0mow/4xtyq1Y8i1Aa1IiuZES+wZ/Nat dCac5z/1jA1V7feVH9wkt1fnKCcldAo3dXaj3Ju5PfwLvvW6zXalQO3xqfuh35bJ9L0+ 4JdOo3fi/C3+rLFGkKgC0m/t+D47a+PaJ9CylFYQ7plJhxfzpV2IZNOsRzaQUbm0R+ZO 47+wlW+eN9brFrCw2xPxD1x2scbFkPHsLJmxyIdGXnVnl+NF7DqTEPtmwYFZ6NMQmjhv CFkd2y72TTlkeUnIsV9CPah+Nu3LObabsn1hL6qY/oKHrTmEFEOdn/GOmEk1qxS/kXbI quMQ== X-Forwarded-Encrypted: i=1; AJvYcCUZecevCV1MhTtk0ReDJrHKxuCkDm/dwZRZdM+IAEo2lTlOQOmAfPC/dy/kmKiWNdKtlf2N2RpE/wLdo+M=@vger.kernel.org X-Gm-Message-State: AOJu0YzviypFpvtOF7AmHsqxfFkGAHD0iuiCbWc2nawtU7N+zQhk83T7 kJJeS0rdWazgD1Md+Q7eL2cbXKjfnD8VoGwyWqOfSwJRclSGSfVOALbIV2UbcvsjX+Atcu5jLbE ZOFH6 X-Gm-Gg: ATEYQzzwoVBkubuUClSiSOhAedKvGqjzDkgH6SzchB0CFqnHG0yQadp8edjicq4XJkP l2WqajYe0uScKKk5+YrunPIvyhJR2FvpUSRGMzJ2P2gIi5cMa3UYuiY5eNoMpodhjxmWVGuak/h X2WyfS1HqJ3zO5k2pg+R6J7Bmw1zE+FS7flV48MA6vDPZHLIDUezseIPV4HuxiRbMKq8+QCw2Cn YoFjvOwv4z8zY+Y3DG/MVOUDi2oiahV6ZpZXBBz9gVWdbMnLGZS6uGHOSAGHQtWlPLYwQXVNyQs h6w+gTSw2eNy+e1l4klNYhweqmhSkC9YnLZ9f5l3z4ltR3gCOxLt21bfqSnPm9kZQPvfRon0nfm qjYHBEtfP2JeA6wBze9Lzc+66czTLpCWXI6Nka6+rtBddbYbl90DdyEdYp3Nc/zTKfbIfCcDJFw w6EDinzKhGKmL85WOTUBT6Kw== X-Received: by 2002:a05:620a:6cc5:b0:8cd:93b7:ebc7 with SMTP id af79cd13be357-8cda1a7cf07mr806659185a.74.1773325629905; Thu, 12 Mar 2026 07:27:09 -0700 (PDT) Received: from localhost ([2603:7000:c00:3a00:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cda71834d9sm291561885a.14.2026.03.12.07.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 07:27:09 -0700 (PDT) Date: Thu, 12 Mar 2026 10:27:08 -0400 From: Johannes Weiner To: Usama Arif Cc: Andrew Morton , npache@redhat.com, david@kernel.org, ziy@nvidia.com, willy@infradead.org, linux-mm@kvack.org, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, linux-kernel@vger.kernel.org, kernel-team@meta.com, richard.weiyang@gmail.com Subject: Re: [PATCH v3] mm: migrate: requeue destination folio on deferred split queue Message-ID: References: <20260312104723.1351321-1-usama.arif@linux.dev> 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: <20260312104723.1351321-1-usama.arif@linux.dev> On Thu, Mar 12, 2026 at 03:47:23AM -0700, Usama Arif wrote: > During folio migration, __folio_migrate_mapping() removes the source > folio from the deferred split queue, but the destination folio is never > re-queued. This causes underutilized THPs to escape the shrinker after > NUMA migration, since they silently drop off the deferred split list. > > Fix this by recording whether the source folio was on the deferred split > queue and its partially mapped state before move_to_new_folio() unqueues > it, and re-queuing the destination folio after a successful migration if > it was. > > By the time migrate_folio_move() runs, partially mapped folios without a > pin have already been split by migrate_pages_batch(). So only two cases > remain on the deferred list at this point: > 1. Partially mapped folios with a pin (split failed). > 2. Fully mapped but potentially underused folios. > The recorded partially_mapped state is forwarded to deferred_split_folio() > so that the destination folio is correctly re-queued in both cases. > > Reported-by: Johannes Weiner > Fixes: dafff3f4c850 ("mm: split underused THPs") > Acked-by: Zi Yan > Acked-by: David Hildenbrand (Arm) > Signed-off-by: Usama Arif Acked-by: Johannes Weiner