[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3ed39039-e20b-49b4-a589-665d55105f00@redhat.com>
Date: Fri, 5 Sep 2025 11:12:57 +0200
From: David Hildenbrand <david@...hat.com>
To: Pankaj Raghav <kernel@...kajraghav.com>,
Kiryl Shutsemau <kirill@...temov.name>
Cc: Zi Yan <ziy@...dia.com>, Ryan Roberts <ryan.roberts@....com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>, Barry Song <baohua@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>, Nico Pache <npache@...hat.com>,
Dev Jain <dev.jain@....com>, "Liam R . Howlett" <Liam.Howlett@...cle.com>,
linux-kernel@...r.kernel.org, willy@...radead.org, linux-mm@...ck.org,
mcgrof@...nel.org, gost.dev@...sung.com, Pankaj Raghav <p.raghav@...sung.com>
Subject: Re: [PATCH v2] huge_memory: return -EINVAL in folio split functions
when THP is disabled
On 05.09.25 10:13, Pankaj Raghav wrote:
> On 9/4/25 17:26, Kiryl Shutsemau wrote:
>> On Thu, Sep 04, 2025 at 11:51:29AM +0200, Pankaj Raghav (Samsung) wrote:
>>> From: Pankaj Raghav <p.raghav@...sung.com>
>>>
>>> split_huge_page_to_list_[to_order](), split_huge_page() and
>>> try_folio_split() return 0 on success and error codes on failure.
>>>
>>> When THP is disabled, these functions return 0 indicating success even
>>> though an error code should be returned as it is not possible to split a
>>> folio when THP is disabled.
>>>
>>> Make all these functions return -EINVAL to indicate failure instead of
>>> 0. As large folios depend on CONFIG_THP, issue warning as this function
>>> should not be called without a large folio.
>>>
>>> Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
>>
>> Acked-by: Kiryl Shutsemau <kas@...nel.org>
>>
>> Just curious, did you give BUILD_BUG() a try?
>>
>
> Yes, I tried BUILD_BUG() but it actually fails the build because truncate_inode_partial_folio()
> calls try_folio_split().
>
> It won't be called in runtime because there is a check for large folios before we call this
> function. So a runtime warning is better in this case.
Right, folio_test_large() is not compiled out.
--
Cheers
David / dhildenb
Powered by blists - more mailing lists