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 DBFEA7E for ; Wed, 2 Nov 2022 02:45:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBDB9C433B5; Wed, 2 Nov 2022 02:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667357146; bh=QRWUUVZN+HyeUyXIafXoBrNCZnxV1rlGwKn4WNaJlIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIOZqB7M5bmluVybaYie5WiD8cIIPRArDFW5d3IUIZ2RfPIFkZH9ZvnGfETnWUGDm cJpNSaTiopApU7kz775RDEdi1PbUIuE3M58iBZKXG9ryUvbpLZO3vHntPzTJb9fVBy yuEKBSHLOHXukxYXyqVyy+gs3JBr8GTZjl0oJhB0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hugh Dickins , Mel Gorman , "Matthew Wilcox (Oracle)" , Andrew Morton Subject: [PATCH 6.0 092/240] mm: prep_compound_tail() clear page->private Date: Wed, 2 Nov 2022 03:31:07 +0100 Message-Id: <20221102022113.477013951@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102022111.398283374@linuxfoundation.org> References: <20221102022111.398283374@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Hugh Dickins commit 5aae9265ee1a30cf716d6caf6b29fe99b9d55130 upstream. Although page allocation always clears page->private in the first page or head page of an allocation, it has never made a point of clearing page->private in the tails (though 0 is often what is already there). But now commit 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split") issues a warning when page_tail->private is found to be non-0 (unless it's swapcache). Change that warning to dump page_tail (which also dumps head), instead of just the head: so far we have seen dead000000000122, dead000000000003, dead000000000001 or 0000000000000002 in the raw output for tail private. We could just delete the warning, but today's consensus appears to want page->private to be 0, unless there's a good reason for it to be set: so now clear it in prep_compound_tail() (more general than just for THP; but not for high order allocation, which makes no pass down the tails). Link: https://lkml.kernel.org/r/1c4233bb-4e4d-5969-fbd4-96604268a285@google.com Fixes: 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split") Signed-off-by: Hugh Dickins Acked-by: Mel Gorman Cc: Matthew Wilcox (Oracle) Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/huge_memory.c | 2 +- mm/page_alloc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2452,7 +2452,7 @@ static void __split_huge_page_tail(struc * Fix up and warn once if private is unexpectedly set. */ if (!folio_test_swapcache(page_folio(head))) { - VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head); + VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, page_tail); page_tail->private = 0; } --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -804,6 +804,7 @@ static void prep_compound_tail(struct pa p->mapping = TAIL_MAPPING; set_compound_head(p, head); + set_page_private(p, 0); } void prep_compound_page(struct page *page, unsigned int order)