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 1EB003ED106; Tue, 17 Mar 2026 16:51:24 +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=1773766285; cv=none; b=Fuo7jGsUEoB3W+w4vkMzjlP5mu+LvaWKLBQvkolBCMwOZ/Z+QXq6arGwEeU0ytNSylJmPdRhcKu69t5uDLmEHStrmqSGVHMAzoPYj8fRt/qlVQhWl8QI2hNySDKCj1uznimULex4ggu/ARzeoDjJGvLLeO8TZ+8+88EeZMkPfMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773766285; c=relaxed/simple; bh=wcnAstLFE6BFgzOFt4h+RDSqFpP9wXW6kprjXjqG/MQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tlBnKXH1IZmZTDSHL2jNnvKDw+AvJ1b9m+mDaXr1sURdRCd5DPh0BA8te8bXaiJuAM5FUZjc/QHYAGPZ6Juadpukheib2qeiS6Uq4qjK9fOV9aloq/c7yy5cxKE46OltRM0Hv6N7v/txzO47LSoDuxkrVLZ4TzJx28GgjOe924Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nAYxapwE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nAYxapwE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0126FC4CEF7; Tue, 17 Mar 2026 16:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773766284; bh=wcnAstLFE6BFgzOFt4h+RDSqFpP9wXW6kprjXjqG/MQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nAYxapwEo6C1wXlWwpVgPJtTmMZK0h1B1oVjbNNyoHWpkfpzXXaPnUnDLk7Q7zgn3 Xg7dEtd/x3+9WjjjZ9NMsfbz9pBl+akI3xCQGGNNbiQ9eAr3dTPGAmhg0w6xzQ9iDS ZhYLU14U304utw4DamKmLRI8i5bmEcOMzSKh7tG4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Axel Rasmussen , Shakeel Butt , Johannes Weiner , "Vishal Moola (Oracle)" , David Hildenbrand , Liam Howlett , Lorenzo Stoakes , "Matthew Wilcox (Oracle)" , Michal Hocko , Mike Rapoport , Suren Baghdasaryan , Vlastimil Babka , Roman Gushchin , Muchun Song , Andrew Morton Subject: [PATCH 6.19 211/378] Revert "ptdesc: remove references to folios from __pagetable_ctor() and pagetable_dtor()" Date: Tue, 17 Mar 2026 17:32:48 +0100 Message-ID: <20260317163014.770256419@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260317163006.959177102@linuxfoundation.org> References: <20260317163006.959177102@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Axel Rasmussen commit 2d28ed588f8d7d0d41b0a4fad7f0d05e4bbf1797 upstream. This change swapped out mod_node_page_state for lruvec_stat_add_folio. But, these two APIs are not interchangeable: the lruvec version also increments memcg stats, in addition to "global" pgdat stats. So after this change, the "pagetables" memcg stat in memory.stat always yields "0", which is a userspace visible regression. I tried to look for a refactor where we add a variant of lruvec_stat_mod_folio which takes a pgdat and a memcg instead of a folio, to try to adhere to the spirit of the original patch. But at the end of the day this just means we have to call folio_memcg(ptdesc_folio(ptdesc)) anyway, which doesn't really accomplish much. This regression is visible in master as well as 6.18 stable, so CC stable too. Link: https://lkml.kernel.org/r/20260225002434.2953895-1-axelrasmussen@google.com Fixes: f0c92726e89f ("ptdesc: remove references to folios from __pagetable_ctor() and pagetable_dtor()") Signed-off-by: Axel Rasmussen Acked-by: Shakeel Butt Acked-by: Johannes Weiner Reviewed-by: Vishal Moola (Oracle) Cc: David Hildenbrand Cc: Liam Howlett Cc: Lorenzo Stoakes Cc: Matthew Wilcox (Oracle) Cc: Michal Hocko Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Roman Gushchin Cc: Muchun Song Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- include/linux/mm.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3304,26 +3304,21 @@ static inline bool ptlock_init(struct pt static inline void ptlock_free(struct ptdesc *ptdesc) {} #endif /* defined(CONFIG_SPLIT_PTE_PTLOCKS) */ -static inline unsigned long ptdesc_nr_pages(const struct ptdesc *ptdesc) -{ - return compound_nr(ptdesc_page(ptdesc)); -} - static inline void __pagetable_ctor(struct ptdesc *ptdesc) { - pg_data_t *pgdat = NODE_DATA(memdesc_nid(ptdesc->pt_flags)); + struct folio *folio = ptdesc_folio(ptdesc); - __SetPageTable(ptdesc_page(ptdesc)); - mod_node_page_state(pgdat, NR_PAGETABLE, ptdesc_nr_pages(ptdesc)); + __folio_set_pgtable(folio); + lruvec_stat_add_folio(folio, NR_PAGETABLE); } static inline void pagetable_dtor(struct ptdesc *ptdesc) { - pg_data_t *pgdat = NODE_DATA(memdesc_nid(ptdesc->pt_flags)); + struct folio *folio = ptdesc_folio(ptdesc); ptlock_free(ptdesc); - __ClearPageTable(ptdesc_page(ptdesc)); - mod_node_page_state(pgdat, NR_PAGETABLE, -ptdesc_nr_pages(ptdesc)); + __folio_clear_pgtable(folio); + lruvec_stat_sub_folio(folio, NR_PAGETABLE); } static inline void pagetable_dtor_free(struct ptdesc *ptdesc)