From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A56A332ABCF for ; Tue, 25 Nov 2025 17:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764092702; cv=none; b=IMZ/QkJI2MnX8Ag3LQ/eRAJ1iZUc/uJcbljPary2sP617VPDljuKtM8UEglimjty6mu7IrhJsCESR0b8mEQUbxqtRfdbycFv2Cct4jT2u0SD3fEMK+Us5UsQeZpFjWpN64V8SEQ1wmGOvSPfXtKmgP2Ferpq5NyqZsVmI2aAXio= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764092702; c=relaxed/simple; bh=6MjkRoP4KxQJr+bGxbbmNLcKblvkslWo6AD5hzFT+7A=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=ddEL88LaVA6M2ftiKHs9FjKHvX4DlzmW9vpaZjclqndmjWl9dLWVSCVywAm5kt6pKi28lfgZARhfHNDcOnvRR4PlgjLXlGPe1cW2n3jeL3jasmT2+HOeLLVsLt66YjMOKwz5hzqrpVWvJkQ2rRkFVGKTUUPsM+x/f2PNw7tX82Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=VZHX3MXu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="VZHX3MXu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC939C4CEF1; Tue, 25 Nov 2025 17:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1764092701; bh=6MjkRoP4KxQJr+bGxbbmNLcKblvkslWo6AD5hzFT+7A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VZHX3MXuUJbaIP/03cfPB3m2zz+aI32MRUB+0az3g0J0DyuFi+V1/9TDbA7GU29Rm 2m8CSzSSnqW590XSa0mQ3Qlg5Xx3mZif3tGde9PaMllTJZeGPKZQTdCir0UgokR7Jq L0oU/9SiEHEiIow4mbbt39RwA6yDrofzLUL+jNLE= Date: Tue, 25 Nov 2025 09:44:46 -0800 From: Andrew Morton To: "David Hildenbrand (Red Hat)" Cc: Zi Yan , Lorenzo Stoakes , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Miaohe Lin , Naoya Horiguchi , Wei Yang , Balbir Singh , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/4] mm/huge_memory: change folio_split_supported() to folio_check_splittable() Message-Id: <20251125094446.c78c5139f00ad8e00e9bd5d9@linux-foundation.org> In-Reply-To: References: <20251122025529.1562592-1-ziy@nvidia.com> <20251122025529.1562592-2-ziy@nvidia.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Tue, 25 Nov 2025 09:58:03 +0100 "David Hildenbrand (Red Hat)" wrote: > > + * Return: 0 - @folio can be split to @new_order, otherwise an error number is > > + * returned. > > + */ > > +int folio_check_splittable(struct folio *folio, unsigned int new_order, > > + enum split_type split_type, bool warns) > > { > > + VM_WARN_ON_FOLIO(!folio_test_locked(folio), folio); > > + /* > > + * Folios that just got truncated cannot get split. Signal to the > > + * caller that there was a race. > > + * > > + * TODO: this will also currently refuse shmem folios that are in the > > + * swapcache. > > + */ > > Per the other discussion, should this even be: > > "this will also currently refuse folios without a mapping in the > swapcache (shmem or to-be-anon folios)" > > IOW, to spell out that anon folios that were read into the swapcache but > not mapped yet into page tables (where we set folio->mapping). This? --- a/mm/huge_memory.c~mm-huge_memory-change-folio_split_supported-to-folio_check_splittable-fix +++ a/mm/huge_memory.c @@ -3714,7 +3714,8 @@ int folio_check_splittable(struct folio * caller that there was a race. * * TODO: this will also currently refuse shmem folios that are in the - * swapcache. + * swapcache. Currently it will also refuse folios without a mapping + * in the swapcache (shmem or to-be-anon folios). */ if (!folio_test_anon(folio) && !folio->mapping) return -EBUSY; _