From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 4BA573085A0; Wed, 18 Jun 2025 18:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750270033; cv=none; b=f51nlG5V4Kfu8STiVupK8TdlS2XH6xGMY0GvzIIDVrNZBNYjN957EEMiMwQCQDLfpfMG8+xquhg+cvRVA0A/sH0uF/m8ISen5BtT5VesEiGNMjHKxSzpQSqw8q/qO1nRlSTAqqvVqcn9Jfe87LB6+Db4wbfsDmBO+NDsCNQMYgU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750270033; c=relaxed/simple; bh=KNokV8mdZiInOwdJ5eC48eeVWIPZcyZM/PsfuegyR0w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tiwoSuRRePMEXM5dC458nB5eKDoC+JdDxbPT8RFFiSsWj+AxfraNenhZ8XOXz01KxHh20FJKx+tX+CxXpyEwz3dN2ailzifT/2C17N3gYEOhVuivMSxMYt3E1XoY0xhlzsmIIbzTurPvgEbuePCAvK/nM/hUGo9NB+VPyAebbcQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=a6vX8oca; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="a6vX8oca" 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> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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.