Re: [RFC v11 08/14] mm: page_frag: some minor refactoring before adding new API

From: Yunsheng Lin
Date: Wed Jul 31 2024 - 08:35:50 EST


On 2024/7/30 23:12, Alexander H Duyck wrote:

...

>> }
>>
>> nc->pagecnt_bias--;
>> nc->remaining = remaining - fragsz;
>>
>> return encoded_page_address(encoded_va) +
>> (page_frag_cache_page_size(encoded_va) - remaining);
>
> Parenthesis here shouldn't be needed, addition and subtractions
> operations can happen in any order with the result coming out the same.

I am playing safe to avoid overflow here, as I am not sure if the allocator
will give us the last page. For example, '0xfffffffffffff000 + 0x1000' will
have a overflow.