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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D116FA373E for ; Tue, 25 Oct 2022 10:03:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7463E8E0002; Tue, 25 Oct 2022 06:03:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F7248E0001; Tue, 25 Oct 2022 06:03:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E5498E0002; Tue, 25 Oct 2022 06:03:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4CA898E0001 for ; Tue, 25 Oct 2022 06:03:43 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1ADFCAAE17 for ; Tue, 25 Oct 2022 10:03:43 +0000 (UTC) X-FDA: 80059035126.15.C60F64C Received: from outbound-smtp43.blacknight.com (outbound-smtp43.blacknight.com [46.22.139.229]) by imf13.hostedemail.com (Postfix) with ESMTP id 3FA4920011 for ; Tue, 25 Oct 2022 10:03:41 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp43.blacknight.com (Postfix) with ESMTPS id 8910C2550 for ; Tue, 25 Oct 2022 11:03:40 +0100 (IST) Received: (qmail 16574 invoked from network); 25 Oct 2022 10:03:40 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 25 Oct 2022 10:03:40 -0000 Date: Tue, 25 Oct 2022 11:03:38 +0100 From: Mel Gorman To: Tvrtko Ursulin Cc: "Matthew Wilcox (Oracle)" , Hugh Dickins , Linux MM , Matthew Auld , Andrew Morton , "Intel-gfx@lists.freedesktop.org" Subject: Re: mm/huge_memory: do not clobber swp_entry_t during THP split Message-ID: <20221025100338.zcvqyji5gwiuj3nj@techsingularity.net> References: <1596edbb-02ad-6bdf-51b8-15c2d2e08b76@linux.intel.com> <20221024142321.f2etddxtqa47bib7@techsingularity.net> <8d9517cc-6fba-ede0-a95f-e9b036e75ceb@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <8d9517cc-6fba-ede0-a95f-e9b036e75ceb@linux.intel.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666692222; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bDxqG5Y4bb5jGZrqRrsWM52DCs43K7VaoRzqki4/OfM=; b=fASapvzDoNCOAFyTu7JHq+NHeLFyLckhXaquHxNCMhalL457aeeYKGuCCBeQSXi9w70Bvf Vuzyhlo8gcYdPcbdl7IRu23GdkGCiMpYKc78HaHIwysDg0fqczoCcSusHikBMCPTjqJwB7 ocS4BTxS13wTRLgV4kAcnZ+wD5rHF9g= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf13.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.229 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666692222; a=rsa-sha256; cv=none; b=RTR5fBsZMBttEGz7VwU8zGlq7B9udNcspvbAg09qBJZ1FTGpcWvPpqxPVobmlsK2+cl20b RxJ/veSg22MxRD6M+vZn3Ke8+qURRRDVRUbag1ogielXxTbJN7xL4Y2bcoifIGZc9/0dTn mPdj/+vhePWBDDb/71Zvzjax8+KmvQI= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3FA4920011 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf13.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.229 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Stat-Signature: p674p7dp94kcx36rk74t47xqhir5hwgo X-HE-Tag: 1666692221-367999 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Cc'ing Andrew for awareness. Andrew, this bug report is almost identical to the one Hugh already reported and fixed in "[PATCH] mm: prep_compound_tail() clear page->private". Nothing wrong with the patch AFAIK and only the last paragraph is relevant to you. On Tue, Oct 25, 2022 at 09:50:14AM +0100, Tvrtko Ursulin wrote: > > On 24/10/2022 15:23, Mel Gorman wrote: > > On Mon, Oct 24, 2022 at 02:04:50PM +0100, Tvrtko Ursulin wrote: > > > > > > Hi Mel, mm experts, > > > > > > With 6.1-rc2 we started hitting the WARN_ON added in 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split") in i915 automated CI: > > > > > > > Thanks for the report. As shmem pages pages are allocated via vma_alloc_folio > > and are compound pages, can you try the following patch please? If it > > still triggers, please post the new oops as it'll include the tail page > > information. > > > > --8<-- > > From: Hugh Dickins > > Subject: [PATCH] mm: prep_compound_tail() clear page->private > > > > 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). > > > > Fixes: 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split") > > Signed-off-by: Hugh Dickins > > Cc: Mel Gorman > > Cc: Matthew Wilcox (Oracle) > > Cc: > > --- > > mm/huge_memory.c | 2 +- > > mm/page_alloc.c | 1 + > > 2 files changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index 03fc7e5edf07..561a42567477 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -2462,7 +2462,7 @@ static void __split_huge_page_tail(struct page *head, int tail, > > * 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; > > } > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index b5a6c815ae28..218b28ee49ed 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -807,6 +807,7 @@ static void prep_compound_tail(struct page *head, int tail_idx) > > p->mapping = TAIL_MAPPING; > > set_compound_head(p, head); > > + set_page_private(p, 0); > > } > > void prep_compound_page(struct page *page, unsigned int order) > > The patch seems to fix our CI runs. Thanks for letting me know. > Is it considered final version? AFAIK, yes. > If so I > can temporarily put it in until it arrives via the next rc - assuming that > would be the flow from upstream pov? > I expect it to. It's currently in the akpm/mm.git branch mm/mm-hotfixes-unstable where I expect it to flow to mm/mm-hotfixes-stable in due course before sending to Linus. I can't make promises about the timing as that's determined by Andrew. -- Mel Gorman SUSE Labs