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

From
Alexander H Duyck <hidden>
Date
2024-07-31 17:02:25
Also in
linux-mm, lkml
Reply to
Yunsheng Lin, 2024-07-31
On Wed, 2024-07-31 at 20:35 +0800, Yunsheng Lin wrote:
On 2024/7/30 23:12, Alexander H Duyck wrote:

...
quoted
quoted
        }

        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.
So what if it does though? When you subtract remaining it will
underflow and go back to the correct value shouldn't it?
Thread (43 messages) 43 messages, 3 authors, last reply 2024-08-14
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help