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 AA74F2144AE for ; Fri, 10 Jan 2025 18:59:18 +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=1736535560; cv=none; b=pqyl4/6cxzu47W3ezn92qIbFQB0Z6sdyy9oUTkDY95JKbFgiRbAAjZvA+WRfBfzCIt5EB52ypJ5oN1Foi6o3SmtL/sjEdjHcTyobwO43Ob6VS+x3XBJdZIdBKAPqHneWrF8lzwyMIRLrkkk8f0mfu56aM0itQujy3RnQOH6IHRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736535560; c=relaxed/simple; bh=jipGvLDjjfRko729IYDETloUmLo+pRy7UPTBbCdv98I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sekqLJjb0v0PSQ8U9jLa94qbfO6Zby0RQ4LFfi4p/Mt3A7RZOVjwA7NYebepsyDjQzMU537q1MPNcXL2CPC1P1OlGk85x8kwQ2WOVxr0DS6vMqpZVQON0xdqymTAB3fyHDVaLfgonUiPhFd6Z8qjGEpRuzK+E8jCj/UpKELC4TU= 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=WwiF1MAS; 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="WwiF1MAS" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=dU1KPYOgyCvWAAqNLgWBHJxOFqc1IkqmFwt63vsT8Oc=; b=WwiF1MASmGGRQJPkkDOD5OefUy KR7q8u6RkOYMvvLqtg0sCfoT6r6ooinjAJlU57SMuBgMEKDRGNwHP3zgPDH+lgWugJz0jAe3iqomy 4qvNcadPWskDyGvHhjqnjIplFe6XMCuPJ+FCAEaCH4a/8dVuqvggMy6K4Ls0gnWaawvvV1EV7RNBS Vyp2wE/J8pBZvGJ0tLxDKDCCdHpOEuEg4nFUQ5oSBx6yUkELjfOaKkNdK8MTTrtkvi5AxDEqIBEkg xyXa6tYGFyzg87/ZXRzP9AqkdyVCZTpAZ9crj14Q71jdc1MvW1MtWzgyzSE72u+cd6vZNtfehDuMK 0LhtgCeg==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tWKDz-0000000ECeU-1x9y; Fri, 10 Jan 2025 18:59:15 +0000 Date: Fri, 10 Jan 2025 18:59:15 +0000 From: Matthew Wilcox To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Muchun Song Subject: Re: [PATCH v1 6/6] mm/hugetlb: use folio->lru int demote_free_hugetlb_folios() Message-ID: References: <20250110182149.746551-1-david@redhat.com> <20250110182149.746551-7-david@redhat.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: <20250110182149.746551-7-david@redhat.com> On Fri, Jan 10, 2025 at 07:21:49PM +0100, David Hildenbrand wrote: > We are demoting hugetlb folios to smaller hugetlb folios; let's avoid > messing with pages where avoidable. > > Signed-off-by: David Hildenbrand Good stuff. I have questions. > +++ b/mm/hugetlb.c > @@ -3822,13 +3822,15 @@ static long demote_free_hugetlb_folios(struct hstate *src, struct hstate *dst, > > for (i = 0; i < pages_per_huge_page(src); i += pages_per_huge_page(dst)) { > struct page *page = folio_page(folio, i); > + struct folio *new_folio; I'm usually very against casting from page to folio, but I think it might be the better option in this case ... > page->mapping = NULL; because then we could do new_folio->mapping = NULL. We're going to have to do serious changes to this function anyway to convert from Ottawa to the New York interpretation, so the cast doesn't give me the feeling of danger that it would elsewhere. > clear_compound_head(page); > prep_compound_page(page, dst->order); > + new_folio = page_folio(page); > > - init_new_hugetlb_folio(dst, page_folio(page)); > - list_add(&page->lru, &dst_list); > + init_new_hugetlb_folio(dst, new_folio); > + list_add(&new_folio->lru, &dst_list); > } > } > > -- > 2.47.1 >