lkml.org 
[lkml]   [2022]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH mm-unstable] mm: move folio_set_compound_order() to mm/internal.h
On Tue, 13 Dec 2022 13:20:53 -0800 Sidhartha Kumar <sidhartha.kumar@oracle.com> wrote:

> folio_set_compound_order() is moved to an mm-internal location so external
> folio users cannot misuse this function. Change the name of the function
> to folio_set_order() and use WARN_ON_ONCE() rather than BUG_ON. Also,
> handle the case if a non-large folio is passed and add clarifying comments
> to the function.
>

This differs from the version I previously merged:

--- a/mm/internal.h~mm-move-folio_set_compound_order-to-mm-internalh-update
+++ a/mm/internal.h
@@ -384,8 +384,10 @@ int split_free_page(struct page *free_pa
*/
static inline void folio_set_order(struct folio *folio, unsigned int order)
{
- if (WARN_ON_ONCE(!folio_test_large(folio)))
+ if (!folio_test_large(folio)) {
+ WARN_ON_ONCE(order);
return;
+ }

folio->_folio_order = order;
#ifdef CONFIG_64BIT
Makes sense. But wouldn't

if (WARN_ON_ONCE(order && !folio_test_large(folio)))
be clearer?

\
 
 \ /
  Last update: 2022-12-16 23:27    [W:0.110 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site