linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: convert scan_control.priority int => byte
@ 2018-05-29  2:40 Greg Thelen
  2018-05-29  2:57 ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Thelen @ 2018-05-29  2:40 UTC (permalink / raw)
  To: Andrew Morton, Michal Hocko, Johannes Weiner
  Cc: linux-mm, linux-kernel, Greg Thelen

Reclaim priorities range from 0..12(DEF_PRIORITY).
scan_control.priority is a 4 byte int, which is overkill.

Since commit 6538b8ea886e ("x86_64: expand kernel stack to 16K") x86_64
stack overflows are not an issue.  But it's inefficient to use 4 bytes
for priority.

Use s8 (signed byte) rather than u8 to allow for loops like:
	do {
		...
	} while (--sc.priority >= 0);

This reduces sizeof(struct scan_control) from 96 => 88 bytes (x86_64),
which saves some stack.

scan_control.priority field order is changed to occupy otherwise unused
padding.

Signed-off-by: Greg Thelen <gthelen@google.com>
---
 mm/vmscan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9b697323a88c..541c334bd176 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -83,9 +83,6 @@ struct scan_control {
 	 */
 	struct mem_cgroup *target_mem_cgroup;
 
-	/* Scan (total_size >> priority) pages at once */
-	int priority;
-
 	/* The highest zone to isolate pages for reclaim from */
 	enum zone_type reclaim_idx;
 
@@ -111,6 +108,9 @@ struct scan_control {
 	/* One of the zones is ready for compaction */
 	unsigned int compaction_ready:1;
 
+	/* Scan (total_size >> priority) pages at once */
+	s8 priority;
+
 	/* Incremented by the number of inactive pages that were scanned */
 	unsigned long nr_scanned;
 
-- 
2.17.0.921.gf22659ad46-goog

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-20 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29  2:40 [PATCH] mm: convert scan_control.priority int => byte Greg Thelen
2018-05-29  2:57 ` Matthew Wilcox
2018-05-30  6:12   ` Greg Thelen
2018-05-30  6:12   ` [PATCH v2] mm: condense scan_control Greg Thelen
2018-06-20 20:52     ` Greg Thelen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox