Re: [PATCH v2] mm/debug: Fix minor issues in mm
From: liuye
Date: Wed Mar 12 2025 - 21:05:35 EST
在 2025/3/12 20:20, Matthew Wilcox 写道:
>> - if ((head & 1) == 0) {
>> + if (head & 1) {
>> + foliop = (struct folio *)(head - 1);
>> + idx = folio_page_idx(foliop, page);
>> + } else {
>> foliop = (struct folio *)&precise;
>> idx = 0;
>> if (!folio_test_large(foliop))
>> goto dump;
>> foliop = (struct folio *)page;
>> - } else {
>> - foliop = (struct folio *)(head - 1);
>> - idx = folio_page_idx(foliop, page);
>> }
>>
>> if (idx < MAX_FOLIO_NR_PAGES) {
>
> How is this "simpler"? It seems like churn for the sake of churn.
> NACK.
This modification simplifies the condition check by directly testing
head & 1 instead of using ((head & 1) == 0). The updated logic first handles
the case where head & 1 is set, assigning foliop and idx accordingly.
This improves code readability and reduces unnecessary branching,
making the structure more straightforward and easier to maintain.
I am personally accustomed to this format, but if it is not accepted
by the majority, then drop it.
Thanks,
Liu Ye