From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (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 750F82F1FDB for ; Tue, 27 Jan 2026 23:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769557445; cv=none; b=Q+Lt3nB+8+EN+Amlo/up0Xu1H2jZPpMP6oZhQcRnZ4hzUL7huqc09zRNVW/BsLzgEm8oQABJYztehw9nINv339VyvWSCB9xV3bpzfm3j5I9jeOxkpd3RKQEPHWRokKM81I+Bu0dPBZ781iB4tuY5FAWuan3nTX9d49uZhsXhdE8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769557445; c=relaxed/simple; bh=mZxrKfWzsH+HpL912CxymP7zKV/HmFcJyYKcV/OWayg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VZhFd6SybQfWSuz8kk8DzEpbd6dV7j+xLA8Vnm6L6P5T/fAW3GBYLO2JUJu/QrFXIANUkDd1YXH3ahp5l5N3sJdEO5oFjBRRqJmaH+HyUwPqgjBIjjERCYYTLXM/IyRfUbfC97BFOWT2jjThrGhAjY3P74MD8+FD10Cz+xAVfxU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=ZCd/VEAF; arc=none smtp.client-ip=209.85.160.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="ZCd/VEAF" Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-5032e951106so12016951cf.0 for ; Tue, 27 Jan 2026 15:44:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1769557442; x=1770162242; 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=v1qRlmFFKOqQW1uayanhd5aQp7S6yFTJSXPtSSKOmMM=; b=ZCd/VEAF6jMbYiDECWICPFJ2WMVNzv+fMt3gFm2vpSpJ+TEWFbowgVn5ic5i/3OqB7 /w3L1BB5Kd5EH9pzPa6aPBlZB7HtXo/yAFjY83/iCVFzV3Sm26jpNOY62ELsjrJRNJyF IMlY05ZC8r9wL+DsrVZAgUyK327dLHFMMMn4TkbI+9eIlIjgtP2mBXktBHMBnxes/eRj 2reCNfhLGrZLBBMzsY3QupRXCusSgAPlEQDsQ2khkrMHCmbdz4VyHld6FW+07P9g109E O5l2iUpyIdmtjU5gMYuoV7T6G6QOLsLVAuy4u6naAewNtU0IyjIczuiBnK3TfCuiUlp1 J36A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769557442; x=1770162242; 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=v1qRlmFFKOqQW1uayanhd5aQp7S6yFTJSXPtSSKOmMM=; b=JRsi0kZyaxMQYhkCsh/OKUqpZj79sAaaWA4G6vaoPOmibYzuWW2qi/3/aD+WYa6PBC 0WxVZpDpKSHSClia/40Anv1FcWnoOwtLmFJTTYZfbp9t2fdW+Kj9jCG0KW5B2rXv8KaL PC5WciUVk0C8OVrWYnEQqR0pXcclwetgXuocI/FlDsHbAIXThu6WCjhQGC7ZsZAKxg8Q SP0n3wfBKykbWS6+bIv+V+wTPJ1SNH+pQyfOTl0wZYnhCnp4nU1/KvYedoVwBMnU+RzO 99lnis+zBGcJXFPQRIMTAT0gj2/MFCXuu6KbbCSgVKeH+67+QJ3GMMq30X4K7A1xQB3f 0TKQ== X-Forwarded-Encrypted: i=1; AJvYcCUYZXwJquS4VLxtHlkjYGa/ZVnmbak5OWjtU5g7+t+SLuTNEDJyT3rywlUUO8EJRno1xTWaBA2AHOfYPUE=@vger.kernel.org X-Gm-Message-State: AOJu0YwfoNqbXqfGq87ro5NvTJHyvRY8CIvWicPvXE0Wj0pc7VJ8qBqs zrDMd7G5J8WNi1ea1bTvOp1Dzov8mCcHhVyiBE/9OJoW4134LpcqRZ8JG6dwhMMjCpI= X-Gm-Gg: AZuq6aLUD3BIC3C1d0AblKzjHV+ukrLZrTvPgvwa6B6//i95c7GbIvWSFnynAaDoaxG 7387vkzKFRuj16s08swmJGFBbh6dv23MgS9A2dL8rx3jOA7pjJDcSuvpwSlxpYVT3bBtr5YQR5z Tlz9zycsx/IkyVFGqbZxKkmqgpncWThNOCHiZDQYgwJcU/tJDaLh0PZyqkATp2mvuv5wJA0AQ7U m9sHM3H5zaHAMKM6IgITl+aM6SkWa8uT4xaiey+JXPA7jQOWJx2+Ag9PdUPS9OJiPHKQOfURFYc BHpZpm31lgjuAMC6jwNNuR7F7ATfob4MoPtaBd53kdCBksDQfduUl6PjLx66Myzc5ifo3ZMZyMf EZRS7M8y2bGJDf6HW2O1DHULj5eKv5X6v5kQZ3lJ/yY8MkjdI70dnN9MdhT+t81gLSgwc2FqxPH 1+OEfl/ofRGAlqYssVOfP8W6lXp1EyAQ4Z8C6iiqNPvYgesvrvvYKyOPZAwdiPWL98iL3i7jRCU Wosp8j5 X-Received: by 2002:ac8:5902:0:b0:4ee:2074:4b6e with SMTP id d75a77b69052e-5032fa034e6mr45336511cf.45.1769557442464; Tue, 27 Jan 2026 15:44:02 -0800 (PST) Received: from gourry-fedora-PF4VCD3F (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-894d36a9bdbsm6298466d6.11.2026.01.27.15.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 15:44:01 -0800 (PST) Date: Tue, 27 Jan 2026 18:43:58 -0500 From: Gregory Price To: Bing Jiao Cc: Akinobu Mita , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org, david@kernel.org, mhocko@kernel.org, zhengqi.arch@bytedance.com, shakeel.butt@linux.dev, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com Subject: Re: [PATCH v3 3/3] mm/vmscan: don't demote if there is not enough free memory in the lower memory tier Message-ID: References: <20260108101535.50696-1-akinobu.mita@gmail.com> <20260108101535.50696-4-akinobu.mita@gmail.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: On Tue, Jan 27, 2026 at 11:28:59PM +0000, Bing Jiao wrote: > Hi, Gregory, hope you are doing well. > > I observed that during the allocation of a large folio, > alloc_migration_target() cleans __GFP_RECLAIM but subsequently applies > GFP_TRANSHUGE. Given that GFP_TRANSHUGE includes __GFP_DIRECT_RECLAIM, > I am wondering if this triggers a form of reclamation that should be > avoided during demotion. > > struct folio *alloc_migration_target(struct folio *src, unsigned long private) > ... > if (folio_test_large(src)) { > /* > * clear __GFP_RECLAIM to make the migration callback > * consistent with regular THP allocations. > */ > gfp_mask &= ~__GFP_RECLAIM; > gfp_mask |= GFP_TRANSHUGE; > order = folio_order(src); > } > > #define GFP_TRANSHUGE (GFP_TRANSHUGE_LIGHT | __GFP_DIRECT_RECLAIM) > I think the answer is that the demotion code is a mess and no one actually knows what it's doing. We probably need to rework this entirely because we've now found at least 2 paths which clean and then add reclaim. ~Gregory