Skip to content

Commit a6dc60f

Browse files
hnaztorvalds
authored andcommitted
vmscan: rename sc.may_swap to may_unmap
sc.may_swap does not only influence reclaiming of anon pages but pages mapped into pagetables in general, which also includes mapped file pages. In shrink_page_list(): if (!sc->may_swap && page_mapped(page)) goto keep_locked; For anon pages, this makes sense as they are always mapped and reclaiming them always requires swapping. But mapped file pages are skipped here as well and it has nothing to do with swapping. The real effect of the knob is whether mapped pages are unmapped and reclaimed or not. Rename it to `may_unmap' to have its name match its actual meaning more precisely. Signed-off-by: Johannes Weiner <[email protected]> Reviewed-by: MinChan Kim <[email protected]> Reviewed-by: KOSAKI Motohiro <[email protected]> Cc: Lee Schermerhorn <[email protected]> Cc: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 9de1581 commit a6dc60f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

mm/vmscan.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ struct scan_control {
6060

6161
int may_writepage;
6262

63-
/* Can pages be swapped as part of reclaim? */
64-
int may_swap;
63+
/* Can mapped pages be reclaimed? */
64+
int may_unmap;
6565

6666
/* This context's SWAP_CLUSTER_MAX. If freeing memory for
6767
* suspend, we effectively ignore SWAP_CLUSTER_MAX.
@@ -606,7 +606,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
606606
if (unlikely(!page_evictable(page, NULL)))
607607
goto cull_mlocked;
608608

609-
if (!sc->may_swap && page_mapped(page))
609+
if (!sc->may_unmap && page_mapped(page))
610610
goto keep_locked;
611611

612612
/* Double the slab pressure for mapped and swapcache pages */
@@ -1694,7 +1694,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
16941694
.gfp_mask = gfp_mask,
16951695
.may_writepage = !laptop_mode,
16961696
.swap_cluster_max = SWAP_CLUSTER_MAX,
1697-
.may_swap = 1,
1697+
.may_unmap = 1,
16981698
.swappiness = vm_swappiness,
16991699
.order = order,
17001700
.mem_cgroup = NULL,
@@ -1713,7 +1713,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
17131713
{
17141714
struct scan_control sc = {
17151715
.may_writepage = !laptop_mode,
1716-
.may_swap = 1,
1716+
.may_unmap = 1,
17171717
.swap_cluster_max = SWAP_CLUSTER_MAX,
17181718
.swappiness = swappiness,
17191719
.order = 0,
@@ -1723,7 +1723,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
17231723
struct zonelist *zonelist;
17241724

17251725
if (noswap)
1726-
sc.may_swap = 0;
1726+
sc.may_unmap = 0;
17271727

17281728
sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |
17291729
(GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK);
@@ -1762,7 +1762,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
17621762
struct reclaim_state *reclaim_state = current->reclaim_state;
17631763
struct scan_control sc = {
17641764
.gfp_mask = GFP_KERNEL,
1765-
.may_swap = 1,
1765+
.may_unmap = 1,
17661766
.swap_cluster_max = SWAP_CLUSTER_MAX,
17671767
.swappiness = vm_swappiness,
17681768
.order = order,
@@ -2110,7 +2110,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
21102110
struct reclaim_state reclaim_state;
21112111
struct scan_control sc = {
21122112
.gfp_mask = GFP_KERNEL,
2113-
.may_swap = 0,
2113+
.may_unmap = 0,
21142114
.swap_cluster_max = nr_pages,
21152115
.may_writepage = 1,
21162116
.isolate_pages = isolate_pages_global,
@@ -2147,7 +2147,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
21472147

21482148
/* Force reclaiming mapped pages in the passes #3 and #4 */
21492149
if (pass > 2)
2150-
sc.may_swap = 1;
2150+
sc.may_unmap = 1;
21512151

21522152
for (prio = DEF_PRIORITY; prio >= 0; prio--) {
21532153
unsigned long nr_to_scan = nr_pages - ret;
@@ -2290,7 +2290,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
22902290
int priority;
22912291
struct scan_control sc = {
22922292
.may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),
2293-
.may_swap = !!(zone_reclaim_mode & RECLAIM_SWAP),
2293+
.may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),
22942294
.swap_cluster_max = max_t(unsigned long, nr_pages,
22952295
SWAP_CLUSTER_MAX),
22962296
.gfp_mask = gfp_mask,

0 commit comments

Comments
 (0)