All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20140717132604.GF29639@cmpxchg.org>

diff --git a/a/1.txt b/N1/1.txt
index baf4a8e..ae3aaa3 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -103,3 +103,218 @@ Good point, I didn't even think of that.  Thanks!
 Andrew, could you please replace this patch with the following?
 
 ---
+>From bbe8c1645c77297a96ecd5d64d659ddcd6984d03 Mon Sep 17 00:00:00 2001
+From: Johannes Weiner <hannes@cmpxchg.org>
+Date: Mon, 14 Jul 2014 08:51:54 -0400
+Subject: [patch] mm: vmscan: clean up struct scan_control
+
+Reorder the members by input and output, then turn the individual
+integers for may_writepage, may_unmap, may_swap, compaction_ready,
+hibernation_mode into bit fields to save stack space:
+
++72/-296 -224
+kswapd                                       104     176     +72
+try_to_free_pages                             80      56     -24
+try_to_free_mem_cgroup_pages                  80      56     -24
+shrink_all_memory                             88      64     -24
+reclaim_clean_pages_from_list                168     144     -24
+mem_cgroup_shrink_node_zone                  104      80     -24
+__zone_reclaim                               176     152     -24
+balance_pgdat                                152       -    -152
+
+Suggested-by: Mel Gorman <mgorman@suse.de>
+Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
+---
+ mm/vmscan.c | 99 ++++++++++++++++++++++++++++---------------------------------
+ 1 file changed, 46 insertions(+), 53 deletions(-)
+
+diff --git a/mm/vmscan.c b/mm/vmscan.c
+index c28b8981e56a..81dd858b9d17 100644
+--- a/mm/vmscan.c
++++ b/mm/vmscan.c
+@@ -59,35 +59,20 @@
+ #include <trace/events/vmscan.h>
+ 
+ struct scan_control {
+-	/* Incremented by the number of inactive pages that were scanned */
+-	unsigned long nr_scanned;
+-
+-	/* Number of pages freed so far during a call to shrink_zones() */
+-	unsigned long nr_reclaimed;
+-
+-	/* One of the zones is ready for compaction */
+-	int compaction_ready;
+-
+ 	/* How many pages shrink_list() should reclaim */
+ 	unsigned long nr_to_reclaim;
+ 
+-	unsigned long hibernation_mode;
+-
+ 	/* This context's GFP mask */
+ 	gfp_t gfp_mask;
+ 
+-	int may_writepage;
+-
+-	/* Can mapped pages be reclaimed? */
+-	int may_unmap;
+-
+-	/* Can pages be swapped as part of reclaim? */
+-	int may_swap;
+-
++	/* Allocation order */
+ 	int order;
+ 
+-	/* Scan (total_size >> priority) pages at once */
+-	int priority;
++	/*
++	 * Nodemask of nodes allowed by the caller. If NULL, all nodes
++	 * are scanned.
++	 */
++	nodemask_t	*nodemask;
+ 
+ 	/*
+ 	 * The memory cgroup that hit its limit and as a result is the
+@@ -95,11 +80,27 @@ struct scan_control {
+ 	 */
+ 	struct mem_cgroup *target_mem_cgroup;
+ 
+-	/*
+-	 * Nodemask of nodes allowed by the caller. If NULL, all nodes
+-	 * are scanned.
+-	 */
+-	nodemask_t	*nodemask;
++	/* Scan (total_size >> priority) pages at once */
++	int priority;
++
++	unsigned int may_writepage:1;
++
++	/* Can mapped pages be reclaimed? */
++	unsigned int may_unmap:1;
++
++	/* Can pages be swapped as part of reclaim? */
++	unsigned int may_swap:1;
++
++	unsigned int hibernation_mode:1;
++
++	/* One of the zones is ready for compaction */
++	unsigned int compaction_ready:1;
++
++	/* Incremented by the number of inactive pages that were scanned */
++	unsigned long nr_scanned;
++
++	/* Number of pages freed so far during a call to shrink_zones() */
++	unsigned long nr_reclaimed;
+ };
+ 
+ #define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))
+@@ -2668,15 +2669,14 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
+ {
+ 	unsigned long nr_reclaimed;
+ 	struct scan_control sc = {
++		.nr_to_reclaim = SWAP_CLUSTER_MAX,
+ 		.gfp_mask = (gfp_mask = memalloc_noio_flags(gfp_mask)),
++		.order = order,
++		.nodemask = nodemask,
++		.priority = DEF_PRIORITY,
+ 		.may_writepage = !laptop_mode,
+-		.nr_to_reclaim = SWAP_CLUSTER_MAX,
+ 		.may_unmap = 1,
+ 		.may_swap = 1,
+-		.order = order,
+-		.priority = DEF_PRIORITY,
+-		.target_mem_cgroup = NULL,
+-		.nodemask = nodemask,
+ 	};
+ 
+ 	/*
+@@ -2706,14 +2706,11 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *memcg,
+ 						unsigned long *nr_scanned)
+ {
+ 	struct scan_control sc = {
+-		.nr_scanned = 0,
+ 		.nr_to_reclaim = SWAP_CLUSTER_MAX,
++		.target_mem_cgroup = memcg,
+ 		.may_writepage = !laptop_mode,
+ 		.may_unmap = 1,
+ 		.may_swap = !noswap,
+-		.order = 0,
+-		.priority = 0,
+-		.target_mem_cgroup = memcg,
+ 	};
+ 	struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);
+ 	int swappiness = mem_cgroup_swappiness(memcg);
+@@ -2748,16 +2745,14 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
+ 	unsigned long nr_reclaimed;
+ 	int nid;
+ 	struct scan_control sc = {
+-		.may_writepage = !laptop_mode,
+-		.may_unmap = 1,
+-		.may_swap = !noswap,
+ 		.nr_to_reclaim = SWAP_CLUSTER_MAX,
+-		.order = 0,
+-		.priority = DEF_PRIORITY,
+-		.target_mem_cgroup = memcg,
+-		.nodemask = NULL, /* we don't care the placement */
+ 		.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |
+ 				(GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK),
++		.target_mem_cgroup = memcg,
++		.priority = DEF_PRIORITY,
++		.may_writepage = !laptop_mode,
++		.may_unmap = 1,
++		.may_swap = !noswap,
+ 	};
+ 
+ 	/*
+@@ -3015,12 +3010,11 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
+ 	unsigned long nr_soft_scanned;
+ 	struct scan_control sc = {
+ 		.gfp_mask = GFP_KERNEL,
++		.order = order,
+ 		.priority = DEF_PRIORITY,
++		.may_writepage = !laptop_mode,
+ 		.may_unmap = 1,
+ 		.may_swap = 1,
+-		.may_writepage = !laptop_mode,
+-		.order = order,
+-		.target_mem_cgroup = NULL,
+ 	};
+ 	count_vm_event(PAGEOUTRUN);
+ 
+@@ -3401,14 +3395,13 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
+ {
+ 	struct reclaim_state reclaim_state;
+ 	struct scan_control sc = {
++		.nr_to_reclaim = nr_to_reclaim,
+ 		.gfp_mask = GFP_HIGHUSER_MOVABLE,
+-		.may_swap = 1,
+-		.may_unmap = 1,
++		.priority = DEF_PRIORITY,
+ 		.may_writepage = 1,
+-		.nr_to_reclaim = nr_to_reclaim,
++		.may_unmap = 1,
++		.may_swap = 1,
+ 		.hibernation_mode = 1,
+-		.order = 0,
+-		.priority = DEF_PRIORITY,
+ 	};
+ 	struct zonelist *zonelist = node_zonelist(numa_node_id(), sc.gfp_mask);
+ 	struct task_struct *p = current;
+@@ -3588,13 +3581,13 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
+ 	struct task_struct *p = current;
+ 	struct reclaim_state reclaim_state;
+ 	struct scan_control sc = {
+-		.may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),
+-		.may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),
+-		.may_swap = 1,
+ 		.nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX),
+ 		.gfp_mask = (gfp_mask = memalloc_noio_flags(gfp_mask)),
+ 		.order = order,
+ 		.priority = ZONE_RECLAIM_PRIORITY,
++		.may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),
++		.may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),
++		.may_swap = 1,
+ 	};
+ 	struct shrink_control shrink = {
+ 		.gfp_mask = sc.gfp_mask,
+-- 
+2.0.0
diff --git a/a/content_digest b/N1/content_digest
index 5719508..47c75d0 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -118,6 +118,221 @@
  "\n"
  "Andrew, could you please replace this patch with the following?\n"
  "\n"
- ---
+ "---\n"
+ ">From bbe8c1645c77297a96ecd5d64d659ddcd6984d03 Mon Sep 17 00:00:00 2001\n"
+ "From: Johannes Weiner <hannes@cmpxchg.org>\n"
+ "Date: Mon, 14 Jul 2014 08:51:54 -0400\n"
+ "Subject: [patch] mm: vmscan: clean up struct scan_control\n"
+ "\n"
+ "Reorder the members by input and output, then turn the individual\n"
+ "integers for may_writepage, may_unmap, may_swap, compaction_ready,\n"
+ "hibernation_mode into bit fields to save stack space:\n"
+ "\n"
+ "+72/-296 -224\n"
+ "kswapd                                       104     176     +72\n"
+ "try_to_free_pages                             80      56     -24\n"
+ "try_to_free_mem_cgroup_pages                  80      56     -24\n"
+ "shrink_all_memory                             88      64     -24\n"
+ "reclaim_clean_pages_from_list                168     144     -24\n"
+ "mem_cgroup_shrink_node_zone                  104      80     -24\n"
+ "__zone_reclaim                               176     152     -24\n"
+ "balance_pgdat                                152       -    -152\n"
+ "\n"
+ "Suggested-by: Mel Gorman <mgorman@suse.de>\n"
+ "Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>\n"
+ "---\n"
+ " mm/vmscan.c | 99 ++++++++++++++++++++++++++++---------------------------------\n"
+ " 1 file changed, 46 insertions(+), 53 deletions(-)\n"
+ "\n"
+ "diff --git a/mm/vmscan.c b/mm/vmscan.c\n"
+ "index c28b8981e56a..81dd858b9d17 100644\n"
+ "--- a/mm/vmscan.c\n"
+ "+++ b/mm/vmscan.c\n"
+ "@@ -59,35 +59,20 @@\n"
+ " #include <trace/events/vmscan.h>\n"
+ " \n"
+ " struct scan_control {\n"
+ "-\t/* Incremented by the number of inactive pages that were scanned */\n"
+ "-\tunsigned long nr_scanned;\n"
+ "-\n"
+ "-\t/* Number of pages freed so far during a call to shrink_zones() */\n"
+ "-\tunsigned long nr_reclaimed;\n"
+ "-\n"
+ "-\t/* One of the zones is ready for compaction */\n"
+ "-\tint compaction_ready;\n"
+ "-\n"
+ " \t/* How many pages shrink_list() should reclaim */\n"
+ " \tunsigned long nr_to_reclaim;\n"
+ " \n"
+ "-\tunsigned long hibernation_mode;\n"
+ "-\n"
+ " \t/* This context's GFP mask */\n"
+ " \tgfp_t gfp_mask;\n"
+ " \n"
+ "-\tint may_writepage;\n"
+ "-\n"
+ "-\t/* Can mapped pages be reclaimed? */\n"
+ "-\tint may_unmap;\n"
+ "-\n"
+ "-\t/* Can pages be swapped as part of reclaim? */\n"
+ "-\tint may_swap;\n"
+ "-\n"
+ "+\t/* Allocation order */\n"
+ " \tint order;\n"
+ " \n"
+ "-\t/* Scan (total_size >> priority) pages at once */\n"
+ "-\tint priority;\n"
+ "+\t/*\n"
+ "+\t * Nodemask of nodes allowed by the caller. If NULL, all nodes\n"
+ "+\t * are scanned.\n"
+ "+\t */\n"
+ "+\tnodemask_t\t*nodemask;\n"
+ " \n"
+ " \t/*\n"
+ " \t * The memory cgroup that hit its limit and as a result is the\n"
+ "@@ -95,11 +80,27 @@ struct scan_control {\n"
+ " \t */\n"
+ " \tstruct mem_cgroup *target_mem_cgroup;\n"
+ " \n"
+ "-\t/*\n"
+ "-\t * Nodemask of nodes allowed by the caller. If NULL, all nodes\n"
+ "-\t * are scanned.\n"
+ "-\t */\n"
+ "-\tnodemask_t\t*nodemask;\n"
+ "+\t/* Scan (total_size >> priority) pages at once */\n"
+ "+\tint priority;\n"
+ "+\n"
+ "+\tunsigned int may_writepage:1;\n"
+ "+\n"
+ "+\t/* Can mapped pages be reclaimed? */\n"
+ "+\tunsigned int may_unmap:1;\n"
+ "+\n"
+ "+\t/* Can pages be swapped as part of reclaim? */\n"
+ "+\tunsigned int may_swap:1;\n"
+ "+\n"
+ "+\tunsigned int hibernation_mode:1;\n"
+ "+\n"
+ "+\t/* One of the zones is ready for compaction */\n"
+ "+\tunsigned int compaction_ready:1;\n"
+ "+\n"
+ "+\t/* Incremented by the number of inactive pages that were scanned */\n"
+ "+\tunsigned long nr_scanned;\n"
+ "+\n"
+ "+\t/* Number of pages freed so far during a call to shrink_zones() */\n"
+ "+\tunsigned long nr_reclaimed;\n"
+ " };\n"
+ " \n"
+ " #define lru_to_page(_head) (list_entry((_head)->prev, struct page, lru))\n"
+ "@@ -2668,15 +2669,14 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,\n"
+ " {\n"
+ " \tunsigned long nr_reclaimed;\n"
+ " \tstruct scan_control sc = {\n"
+ "+\t\t.nr_to_reclaim = SWAP_CLUSTER_MAX,\n"
+ " \t\t.gfp_mask = (gfp_mask = memalloc_noio_flags(gfp_mask)),\n"
+ "+\t\t.order = order,\n"
+ "+\t\t.nodemask = nodemask,\n"
+ "+\t\t.priority = DEF_PRIORITY,\n"
+ " \t\t.may_writepage = !laptop_mode,\n"
+ "-\t\t.nr_to_reclaim = SWAP_CLUSTER_MAX,\n"
+ " \t\t.may_unmap = 1,\n"
+ " \t\t.may_swap = 1,\n"
+ "-\t\t.order = order,\n"
+ "-\t\t.priority = DEF_PRIORITY,\n"
+ "-\t\t.target_mem_cgroup = NULL,\n"
+ "-\t\t.nodemask = nodemask,\n"
+ " \t};\n"
+ " \n"
+ " \t/*\n"
+ "@@ -2706,14 +2706,11 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *memcg,\n"
+ " \t\t\t\t\t\tunsigned long *nr_scanned)\n"
+ " {\n"
+ " \tstruct scan_control sc = {\n"
+ "-\t\t.nr_scanned = 0,\n"
+ " \t\t.nr_to_reclaim = SWAP_CLUSTER_MAX,\n"
+ "+\t\t.target_mem_cgroup = memcg,\n"
+ " \t\t.may_writepage = !laptop_mode,\n"
+ " \t\t.may_unmap = 1,\n"
+ " \t\t.may_swap = !noswap,\n"
+ "-\t\t.order = 0,\n"
+ "-\t\t.priority = 0,\n"
+ "-\t\t.target_mem_cgroup = memcg,\n"
+ " \t};\n"
+ " \tstruct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);\n"
+ " \tint swappiness = mem_cgroup_swappiness(memcg);\n"
+ "@@ -2748,16 +2745,14 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,\n"
+ " \tunsigned long nr_reclaimed;\n"
+ " \tint nid;\n"
+ " \tstruct scan_control sc = {\n"
+ "-\t\t.may_writepage = !laptop_mode,\n"
+ "-\t\t.may_unmap = 1,\n"
+ "-\t\t.may_swap = !noswap,\n"
+ " \t\t.nr_to_reclaim = SWAP_CLUSTER_MAX,\n"
+ "-\t\t.order = 0,\n"
+ "-\t\t.priority = DEF_PRIORITY,\n"
+ "-\t\t.target_mem_cgroup = memcg,\n"
+ "-\t\t.nodemask = NULL, /* we don't care the placement */\n"
+ " \t\t.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |\n"
+ " \t\t\t\t(GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK),\n"
+ "+\t\t.target_mem_cgroup = memcg,\n"
+ "+\t\t.priority = DEF_PRIORITY,\n"
+ "+\t\t.may_writepage = !laptop_mode,\n"
+ "+\t\t.may_unmap = 1,\n"
+ "+\t\t.may_swap = !noswap,\n"
+ " \t};\n"
+ " \n"
+ " \t/*\n"
+ "@@ -3015,12 +3010,11 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,\n"
+ " \tunsigned long nr_soft_scanned;\n"
+ " \tstruct scan_control sc = {\n"
+ " \t\t.gfp_mask = GFP_KERNEL,\n"
+ "+\t\t.order = order,\n"
+ " \t\t.priority = DEF_PRIORITY,\n"
+ "+\t\t.may_writepage = !laptop_mode,\n"
+ " \t\t.may_unmap = 1,\n"
+ " \t\t.may_swap = 1,\n"
+ "-\t\t.may_writepage = !laptop_mode,\n"
+ "-\t\t.order = order,\n"
+ "-\t\t.target_mem_cgroup = NULL,\n"
+ " \t};\n"
+ " \tcount_vm_event(PAGEOUTRUN);\n"
+ " \n"
+ "@@ -3401,14 +3395,13 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)\n"
+ " {\n"
+ " \tstruct reclaim_state reclaim_state;\n"
+ " \tstruct scan_control sc = {\n"
+ "+\t\t.nr_to_reclaim = nr_to_reclaim,\n"
+ " \t\t.gfp_mask = GFP_HIGHUSER_MOVABLE,\n"
+ "-\t\t.may_swap = 1,\n"
+ "-\t\t.may_unmap = 1,\n"
+ "+\t\t.priority = DEF_PRIORITY,\n"
+ " \t\t.may_writepage = 1,\n"
+ "-\t\t.nr_to_reclaim = nr_to_reclaim,\n"
+ "+\t\t.may_unmap = 1,\n"
+ "+\t\t.may_swap = 1,\n"
+ " \t\t.hibernation_mode = 1,\n"
+ "-\t\t.order = 0,\n"
+ "-\t\t.priority = DEF_PRIORITY,\n"
+ " \t};\n"
+ " \tstruct zonelist *zonelist = node_zonelist(numa_node_id(), sc.gfp_mask);\n"
+ " \tstruct task_struct *p = current;\n"
+ "@@ -3588,13 +3581,13 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)\n"
+ " \tstruct task_struct *p = current;\n"
+ " \tstruct reclaim_state reclaim_state;\n"
+ " \tstruct scan_control sc = {\n"
+ "-\t\t.may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),\n"
+ "-\t\t.may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),\n"
+ "-\t\t.may_swap = 1,\n"
+ " \t\t.nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX),\n"
+ " \t\t.gfp_mask = (gfp_mask = memalloc_noio_flags(gfp_mask)),\n"
+ " \t\t.order = order,\n"
+ " \t\t.priority = ZONE_RECLAIM_PRIORITY,\n"
+ "+\t\t.may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),\n"
+ "+\t\t.may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),\n"
+ "+\t\t.may_swap = 1,\n"
+ " \t};\n"
+ " \tstruct shrink_control shrink = {\n"
+ " \t\t.gfp_mask = sc.gfp_mask,\n"
+ "-- \n"
+ 2.0.0
 
-9edf9f5a766f744e2ab06924e378798fcdecc12f2165c126f7ab2b2c91d78a5e
+ede08fc30bf0cc62dae01a1cc199ba76beb505a5ff557dafb9b13c263cc0925e

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.