All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Mel Gorman <mgorman@techsingularity.net>
Cc: Linux MM <linux-mm@kvack.org>,
	"Intel-gfx@lists.freedesktop.org"
	<Intel-gfx@lists.freedesktop.org>,
	Hugh Dickins <hughd@google.com>,
	Matthew Auld <matthew.auld@intel.com>,
	"Matthew Wilcox \(Oracle\)" <willy@infradead.org>
Subject: Re: [Intel-gfx] mm/huge_memory: do not clobber swp_entry_t during THP split
Date: Tue, 25 Oct 2022 09:50:14 +0100	[thread overview]
Message-ID: <8d9517cc-6fba-ede0-a95f-e9b036e75ceb@linux.intel.com> (raw)
In-Reply-To: <20221024142321.f2etddxtqa47bib7@techsingularity.net>


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 <hughd@google.com>
> 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 <hughd@google.com>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: <stable@vger.kernel.org>
> ---
>   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. Is it considered final version? If 
so I can temporarily put it in until it arrives via the next rc - 
assuming that would be the flow from upstream pov?

Regards,

Tvrtko

WARNING: multiple messages have this Message-ID (diff)
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Mel Gorman <mgorman@techsingularity.net>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Hugh Dickins <hughd@google.com>, Linux MM <linux-mm@kvack.org>,
	Matthew Auld <matthew.auld@intel.com>,
	"Intel-gfx@lists.freedesktop.org"
	<Intel-gfx@lists.freedesktop.org>
Subject: Re: mm/huge_memory: do not clobber swp_entry_t during THP split
Date: Tue, 25 Oct 2022 09:50:14 +0100	[thread overview]
Message-ID: <8d9517cc-6fba-ede0-a95f-e9b036e75ceb@linux.intel.com> (raw)
In-Reply-To: <20221024142321.f2etddxtqa47bib7@techsingularity.net>


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 <hughd@google.com>
> 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 <hughd@google.com>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: <stable@vger.kernel.org>
> ---
>   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. Is it considered final version? If 
so I can temporarily put it in until it arrives via the next rc - 
assuming that would be the flow from upstream pov?

Regards,

Tvrtko


  reply	other threads:[~2022-10-25  8:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 13:04 [Intel-gfx] mm/huge_memory: do not clobber swp_entry_t during THP split Tvrtko Ursulin
2022-10-24 13:04 ` Tvrtko Ursulin
2022-10-24 14:23 ` [Intel-gfx] " Mel Gorman
2022-10-24 14:23   ` Mel Gorman
2022-10-25  8:50   ` Tvrtko Ursulin [this message]
2022-10-25  8:50     ` Tvrtko Ursulin
2022-10-25 10:03     ` [Intel-gfx] " Mel Gorman
2022-10-25 10:03       ` Mel Gorman
2022-10-25 15:26       ` [Intel-gfx] " Hugh Dickins
2022-10-25 15:26         ` Hugh Dickins
2022-10-26  9:25         ` [Intel-gfx] " Mel Gorman
2022-10-26  9:25           ` Mel Gorman
2022-10-26  3:04       ` [Intel-gfx] " Andrew Morton
2022-10-26  3:04         ` Andrew Morton
2022-10-26  3:35         ` [Intel-gfx] " Hugh Dickins
2022-10-26  3:35           ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d9517cc-6fba-ede0-a95f-e9b036e75ceb@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=matthew.auld@intel.com \
    --cc=mgorman@techsingularity.net \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.