Re: [PATCH v3 2/3] mm/compaction: add support for >0 order folio memory compaction.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9 Feb 2024, at 15:46, Vlastimil Babka wrote:

> On 2/9/24 20:40, Zi Yan wrote:
>> On 9 Feb 2024, at 14:36, Zi Yan wrote:
>>
>>> On 9 Feb 2024, at 11:37, Vlastimil Babka wrote:
>>>
>>>> On 2/2/24 17:15, Zi Yan wrote:
>>>>
>>>> ...
>>>>
>>>>>  /*
>>>>> @@ -1835,9 +1857,17 @@ static struct folio *compaction_alloc(struct folio *src, unsigned long data)
>>>>>  static void compaction_free(struct folio *dst, unsigned long data)
>>>>>  {
>>>>>  	struct compact_control *cc = (struct compact_control *)data;
>>>>> +	int order = folio_order(dst);
>>>>> +	struct page *page = &dst->page;
>>>>> +
>>>>> +	folio_set_count(dst, 0);
>>>>
>>>> We can't change refcount to 0 like this, after it was already set to 1 and
>>>> somebody else might have done get_page_unless_zero(). You need to either
>>>> put_page_testzero() and if it's false, consider the page lost, or leave it
>>>> refcounted and adjust the code to handle both refcounted and non-refcounted
>>>> pages on the lists (the first option is simpler and shouldn't be too bad).
>>> Got it. Will fix it with the first option. Thanks.
>>
>> Do you think we should have a WARN or WARN_ONCE if we lose a page here?
>
> No, no WARN, it all happens legitimately. It's only our compaction losing
> the page - whoever would do the get_page_unless_zero() to inspect that page
> would then have to put_page() which will free it back to page allocator.

Got it. Thanks for the explanation.

--
Best Regards,
Yan, Zi

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux