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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B6F3C7115A for ; Wed, 18 Jun 2025 18:07:21 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4bMsCC6qS3z3c5M; Thu, 19 Jun 2025 04:07:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2001:8b0:10b:1236::1" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1750270039; cv=none; b=Y8usbDCcZWfhhKYsP7I8KSI0PbPEkh81XrL/GeNsogurHQs25G2Sm1/e1IjROAQCZDDZYvoQCvfm0bB4qP8bBXu5aziF3OSYEy6WId7c0t9ExScnkCL26m4BgzoCkwMKyy90UwMmhrBi4a+l+6CUWu2X/eFf5uCSxex8aIqoR4DVfIi1/diH2MO6t/D57sPKAVw71VksQhrDqoO+CmFMBhFf7i8puuFVl2pAgXnwyshwKH6+mYJhH65Q6YMQhgDmWAgPGYNCZj5h9v5SjTWUkzoGQpL8dFxZMz1Ye5jZivQuLb6HARqkJWrU/3r6BoDPnzYYab62hzdck1bNfUx3MA== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1750270039; c=relaxed/relaxed; bh=J4aHyFboA5TYykyYa0Jlj3sw+Op0fhB4LmjH5FwOZd4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Vvdj3WrbIG8xvIdM2yEIUcUq0HiUeYb/BwBGgyXUBDzYiLHO9p14zU22bC3n+/2E9gvsX/DDaDjECxwzZ+zaUQRi+rtWqg0Z1K9N17h1nDehH7ZyjOTG3fPTc5ZeKbGJB2B4HWaiNxzFYnoszNh4uXI3f6qN98qujMZMuWaMd1O0xzla/KilX5804/sCdQyZnIcdD4XzvNoyIj4fuhuFe40J9zU5+OjcavDYkrF4D9vF45djrpyiAFBW2SnmCUkQYIq9dy4DUMpGVvq2GGZAoQS9O1sNJK2mlnyBYWw7rVipAt4LyuVLEJ4x/viej6bP0CHMb5HIP0B3V7EPAlvmtg== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org; dkim=pass (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=a6vX8oca; dkim-atps=neutral; spf=none (client-ip=2001:8b0:10b:1236::1; helo=casper.infradead.org; envelope-from=willy@infradead.org; receiver=lists.ozlabs.org) smtp.mailfrom=infradead.org Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=a6vX8oca; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=infradead.org (client-ip=2001:8b0:10b:1236::1; helo=casper.infradead.org; envelope-from=willy@infradead.org; receiver=lists.ozlabs.org) Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4bMsC86Vchz3c5J for ; Thu, 19 Jun 2025 04:07:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=J4aHyFboA5TYykyYa0Jlj3sw+Op0fhB4LmjH5FwOZd4=; b=a6vX8ocaJ2qS7neeTyXhBP7TAr 68s84eCnuZZugY9yDOtXOq+dInzY5Ri5o1cXxQPO0n8jy33xnrOkeWCEu4QW7VV+U4h64MOtP9fr4 0TidPl1vB3ZLyUTFgZLx8jesTt4rgniAKKkrD6SzwP6j6ysUVfvFh9sUsWlTCWgvHZVAL7ZIqIaVq AsbGHPyCc+UKKfMpxx+/CBEE1jSLbt2G9bE9rKAgdRGaVt2xAqhiarAo33obYqKsLGkEwakZfOz+5 oyN0+y7fCwzCDk1T59eooIug+hjqFPgBzcAXivpBb2u5dmg9CY76FgERkyiExRHDtkJiXJrLseR5r UFeLDxPQ==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1uRxBa-00000004U8i-3jag; Wed, 18 Jun 2025 18:06:58 +0000 Date: Wed, 18 Jun 2025 19:06:58 +0100 From: Matthew Wilcox To: Zi Yan Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org, Andrew Morton , Jonathan Corbet , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Jerrin Shaji George , Arnd Bergmann , Greg Kroah-Hartman , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Alexander Viro , Christian Brauner , Jan Kara , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Minchan Kim , Sergey Senozhatsky , Brendan Jackman , Johannes Weiner , Jason Gunthorpe , John Hubbard , Peter Xu , Xu Xin , Chengming Zhou , Miaohe Lin , Naoya Horiguchi , Oscar Salvador , Rik van Riel , Harry Yoo , Qi Zheng , Shakeel Butt Subject: Re: [PATCH RFC 04/29] mm/page_alloc: allow for making page types sticky until freed Message-ID: References: <20250618174014.1168640-1-david@redhat.com> <20250618174014.1168640-5-david@redhat.com> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jun 18, 2025 at 02:04:18PM -0400, Zi Yan wrote: > > Let's allow for not clearing a page type before freeing a page to the > > buddy. > > > > We'll focus on having a type set on the first page of a larger > > allocation only. > > > > With this change, we can reliably identify typed folios even though > > they might be in the process of getting freed, which will come in handy > > in migration code (at least in the transition phase). > > + if (unlikely(page_has_type(page))) > > + page->page_type = UINT_MAX; > > + > > if (is_check_pages_enabled()) { > > if (free_page_is_bad(page)) > > bad++; > > -- > > 2.49.0 > > How does this preserve page type? Isn’t page->page_type = UINT_MAX clearing > page_type? The point is that the _caller_ used to have to clear the page type. This patch allows the caller to free the page without clearing the page type first.