* [PATCH] mm/vmscan: reorder scan_balance definition to simplify the scan type check
@ 2022-04-05 8:23 Wei Yang
2022-04-05 12:30 ` Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2022-04-05 8:23 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Wei Yang, Johannes Weiner, Mel Gorman
Even is_file_lru() return bool type, we leverage it as an index for anon
or file.
With this in hand, after reorder scan_balance definition, we can compare
directly between scan_balance and file to get the exclusive scan type.
After this, the code looks more readable and save some instructions.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Johannes Weiner <hannes@cmpxchg.org>
CC: Mel Gorman <mgorman@suse.de>
---
mm/vmscan.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 89745cf34386..0b7cc9309e70 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2638,10 +2638,10 @@ static bool inactive_is_low(struct lruvec *lruvec, enum lru_list inactive_lru)
}
enum scan_balance {
- SCAN_EQUAL,
- SCAN_FRACT,
SCAN_ANON,
SCAN_FILE,
+ SCAN_EQUAL,
+ SCAN_FRACT,
};
/*
@@ -2838,7 +2838,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
case SCAN_FILE:
case SCAN_ANON:
/* Scan one type exclusively */
- if ((scan_balance == SCAN_FILE) != file)
+ if (scan_balance != file)
scan = 0;
break;
default:
--
2.33.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/vmscan: reorder scan_balance definition to simplify the scan type check
2022-04-05 8:23 [PATCH] mm/vmscan: reorder scan_balance definition to simplify the scan type check Wei Yang
@ 2022-04-05 12:30 ` Matthew Wilcox
2022-04-06 23:49 ` Wei Yang
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2022-04-05 12:30 UTC (permalink / raw)
To: Wei Yang; +Cc: akpm, linux-mm, Johannes Weiner, Mel Gorman
On Tue, Apr 05, 2022 at 08:23:57AM +0000, Wei Yang wrote:
> Even is_file_lru() return bool type, we leverage it as an index for anon
> or file.
>
> With this in hand, after reorder scan_balance definition, we can compare
> directly between scan_balance and file to get the exclusive scan type.
>
> After this, the code looks more readable and save some instructions.
This scares me. I would not apply this patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/vmscan: reorder scan_balance definition to simplify the scan type check
2022-04-05 12:30 ` Matthew Wilcox
@ 2022-04-06 23:49 ` Wei Yang
0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2022-04-06 23:49 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Wei Yang, akpm, linux-mm, Johannes Weiner, Mel Gorman
On Tue, Apr 05, 2022 at 01:30:26PM +0100, Matthew Wilcox wrote:
>On Tue, Apr 05, 2022 at 08:23:57AM +0000, Wei Yang wrote:
>> Even is_file_lru() return bool type, we leverage it as an index for anon
>> or file.
>>
>> With this in hand, after reorder scan_balance definition, we can compare
>> directly between scan_balance and file to get the exclusive scan type.
>>
>> After this, the code looks more readable and save some instructions.
>
>This scares me. I would not apply this patch.
Because?
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-06 23:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 8:23 [PATCH] mm/vmscan: reorder scan_balance definition to simplify the scan type check Wei Yang
2022-04-05 12:30 ` Matthew Wilcox
2022-04-06 23:49 ` Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox