[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f73a27ca-91d4-4b1c-a2e3-ef07e56bccf3@redhat.com>
Date: Tue, 25 Jun 2024 11:10:38 +1000
From: Gavin Shan <gshan@...hat.com>
To: David Hildenbrand <david@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>
Cc: Bagas Sanjaya <bagasdotme@...il.com>, Zhenyu Zhang <zhenyzha@...hat.com>,
Linux XFS <linux-xfs@...r.kernel.org>,
Linux Filesystems Development <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Shaoqin Huang <shahuang@...hat.com>, Chandan Babu R
<chandan.babu@...cle.com>, "Darrick J. Wong" <djwong@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: Endless calls to xas_split_alloc() due to corrupted xarray entry
On 6/20/24 5:58 AM, David Hildenbrand wrote:
> On 19.06.24 17:48, Linus Torvalds wrote:
>> On Wed, 19 Jun 2024 at 07:31, Matthew Wilcox <willy@...radead.org> wrote:
>>>
>>> Actually, it's 11. We can't split an order-12 folio because we'd have
>>> to allocate two levels of radix tree, and I decided that was too much
>>> work. Also, I didn't know that ARM used order-13 PMD size at the time.
>>>
>>> I think this is the best fix (modulo s/12/11/).
>>
>> Can we use some more descriptive thing than the magic constant 11 that
>> is clearly very subtle.
>>
>> Is it "XA_CHUNK_SHIFT * 2 - 1"
>
> That's my best guess as well :)
>
>>
>> IOW, something like
>>
>> #define MAX_XAS_ORDER (XA_CHUNK_SHIFT * 2 - 1)
>> #define MAX_PAGECACHE_ORDER min(HPAGE_PMD_ORDER,12)
>>
>> except for the non-TRANSPARENT_HUGEPAGE case where it currently does
>>
>> #define MAX_PAGECACHE_ORDER 8
>>
>> and I assume that "8" is just "random round value, smaller than 11"?
>
> Yes, that matches my understanding.
>
> Maybe to be safe for !THP as well, something ike:
>
> +++ b/include/linux/pagemap.h
> @@ -354,11 +354,18 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
> * a good order (that's 1MB if you're using 4kB pages)
> */
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> -#define MAX_PAGECACHE_ORDER HPAGE_PMD_ORDER
> +#define WANTED_MAX_PAGECACHE_ORDER HPAGE_PMD_ORDER
> #else
> -#define MAX_PAGECACHE_ORDER 8
> +#define WANTED_MAX_PAGECACHE_ORDER 8
> #endif
>
> +/*
> + * xas_split_alloc() does not support arbitrary orders yet. This implies no
> + * 512MB THP on arm64 with 64k.
> + */
> +#define MAX_XAS_ORDER (XA_CHUNK_SHIFT * 2 - 1)
> +#define MAX_PAGECACHE_ORDER min(MAX_XAS_ORDER, WANTED_MAX_PAGECACHE_ORDER)
> +
> /**
> * mapping_set_large_folios() - Indicate the file supports large folios.
> * @mapping: The file.
Thanks David. I'm checking if shmem needs the similar limitation and test patches.
I will post them for review once they're ready.
Thanks,
Gavin
Powered by blists - more mailing lists