linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Wei Yang <richard.weiyang@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@suse.de>
Subject: [PATCH] mm/vmscan: reorder scan_balance definition to simplify the scan type check
Date: Tue,  5 Apr 2022 08:23:57 +0000	[thread overview]
Message-ID: <20220405082357.22606-1-richard.weiyang@gmail.com> (raw)

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



             reply	other threads:[~2022-04-05  8:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05  8:23 Wei Yang [this message]
2022-04-05 12:30 ` Matthew Wilcox
2022-04-06 23:49   ` Wei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220405082357.22606-1-richard.weiyang@gmail.com \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox