Re: [PATCH 1/8] mm/vmscan: remove redundant folio_test_swapbacked check when folio is file lru
From: Miaohe Lin
Date: Tue Mar 29 2022 - 21:47:04 EST
On 2022/3/29 21:46, Matthew Wilcox wrote:
> On Tue, Mar 29, 2022 at 09:26:12PM +0800, Miaohe Lin wrote:
>> When folio is file lru, folio_test_swapbacked is guaranteed to be true. So
>> it's unnecessary to check it here again. No functional change intended.
>
> ummm ... is your logic right here? The condition is:
>
> if (!a || (b && !c))
>
Because a is !c, so c is !a. Then we have:
!a || (b && !c) ==> !a || (b && !!a) ==> !a || (b && a) ==> !a || b.
Or am I miss something?
Thanks.
> I don't see how it follows that a => c means we can do any
> simplification at all.
>
>> Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>> ---
>> mm/vmscan.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 1678802e03e7..7c1a9713bfc9 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1434,8 +1434,7 @@ static void folio_check_dirty_writeback(struct folio *folio,
>> * Anonymous pages are not handled by flushers and must be written
>> * from reclaim context. Do not stall reclaim based on them
>> */
>> - if (!folio_is_file_lru(folio) ||
>> - (folio_test_anon(folio) && !folio_test_swapbacked(folio))) {
>> + if (!folio_is_file_lru(folio) || folio_test_anon(folio)) {
>> *dirty = false;
>> *writeback = false;
>> return;
>> --
>> 2.23.0
>>
>>
>
> .
>