[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fa38b65e-3271-4989-a95a-64bd8c37441e@kylinos.cn>
Date: Thu, 13 Mar 2025 09:04:46 +0800
From: liuye <liuye@...inos.cn>
To: Matthew Wilcox <willy@...radead.org>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm/debug: Fix minor issues in mm
在 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
Powered by blists - more mailing lists