linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
To: John Hubbard <jhubbard@nvidia.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	songmuchun@bytedance.com, mike.kravetz@oracle.com,
	willy@infradead.org
Subject: Re: [PATCH mm-unstable] mm: move folio_set_compound_order() to mm/internal.h
Date: Fri, 16 Dec 2022 15:10:41 -0800	[thread overview]
Message-ID: <389f9eca-7be2-d43a-bc3f-f638b955b55a@oracle.com> (raw)
In-Reply-To: <963ba9b4-6ddf-39bc-85cf-2feef542029d@nvidia.com>

On 12/16/22 2:56 PM, John Hubbard wrote:
> On 12/16/22 14:27, Andrew Morton wrote:
>> 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;
>> +    }
> 
> I think that's out of date?
> 
> We eventually settled on the version that is (as of this a few minutes
> ago) already in mm-unstable (commit fdea060a130d: "mm: move
> folio_set_compound_order() to mm/internal.h"), which has it like this:
> 
Hi Andrew, yes this version that is already in mm-unstable represents 
the v2 of this patch which is what we agreed on. I think the patch 
mm-move-folio_set_compound_order-to-mm-internalh-update with description 
"alter the folio_set_order() warning" which was just added to 
mm-unstable should be removed as our discussion lead us away from that 
version.


>         if (WARN_ON_ONCE(!folio_test_large(folio)))
>                 return;
> 
>>       folio->_folio_order = order;
>>   #ifdef CONFIG_64BIT
>>
>> Makes sense.  But wouldn't
>>
>>     if (WARN_ON_ONCE(order && !folio_test_large(folio)))
>>
>> be clearer?
> That's a little narrower of a check. But maybe that's desirable. Could

Ya I think it would helpful to have a wider catch for the warn as any 
user calling folio_set_order() with a non-large folio should be aware as 
they could misuse the folio later on even if they passed in a 0 order 
because order itself would be an OOB access.

Thanks,
Sidhartha Kumar
> someone (Mike, Muchun, Sidhartha) comment on which behavior is
> preferable, please? I think I'm a little dizzy at this point. :)
> 
> 
> thanks,



      parent reply	other threads:[~2022-12-16 23:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 21:20 [PATCH mm-unstable] mm: move folio_set_compound_order() to mm/internal.h Sidhartha Kumar
2022-12-14  8:43 ` John Hubbard
2022-12-14 20:35   ` Sidhartha Kumar
2022-12-14 22:53     ` John Hubbard
2022-12-15  3:44 ` Muchun Song
2022-12-15  5:09   ` Sidhartha Kumar
2022-12-15  5:31     ` Muchun Song
2022-12-16 22:27 ` Andrew Morton
2022-12-16 22:56   ` John Hubbard
2022-12-16 23:09     ` Andrew Morton
2022-12-16 23:10     ` Sidhartha Kumar [this message]

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=389f9eca-7be2-d43a-bc3f-f638b955b55a@oracle.com \
    --to=sidhartha.kumar@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=songmuchun@bytedance.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).