[merged] mm-memcontrol-move-swap-charge-handling-into-get_swap_page.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm, memcontrol: move swap charge handling into get_swap_page()
has been removed from the -mm tree.  Its filename was
     mm-memcontrol-move-swap-charge-handling-into-get_swap_page.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Tejun Heo <tj@xxxxxxxxxx>
Subject: mm, memcontrol: move swap charge handling into get_swap_page()

Patch series "mm, memcontrol: Implement memory.swap.events", v2.

This patchset implements memory.swap.events which contains max and fail
events so that userland can monitor and respond to swap running out.


This patch (of 2):

get_swap_page() is always followed by mem_cgroup_try_charge_swap().  This
patch moves mem_cgroup_try_charge_swap() into get_swap_page() and makes
get_swap_page() call the function even after swap allocation failure.

This simplifies the callers and consolidates memcg related logic and will
ease adding swap related memcg events.

Link: http://lkml.kernel.org/r/20180416230934.GH1911913@xxxxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx>
Cc: Roman Gushchin <guro@xxxxxx>
Cc: Rik van Riel <riel@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/memcontrol.c |    3 +++
 mm/shmem.c      |    4 ----
 mm/swap_slots.c |   10 +++++++---
 mm/swap_state.c |    3 ---
 4 files changed, 10 insertions(+), 10 deletions(-)

diff -puN mm/memcontrol.c~mm-memcontrol-move-swap-charge-handling-into-get_swap_page mm/memcontrol.c
--- a/mm/memcontrol.c~mm-memcontrol-move-swap-charge-handling-into-get_swap_page
+++ a/mm/memcontrol.c
@@ -6012,6 +6012,9 @@ int mem_cgroup_try_charge_swap(struct pa
 	if (!memcg)
 		return 0;
 
+	if (!entry.val)
+		return 0;
+
 	memcg = mem_cgroup_id_get_online(memcg);
 
 	if (!mem_cgroup_is_root(memcg) &&
diff -puN mm/shmem.c~mm-memcontrol-move-swap-charge-handling-into-get_swap_page mm/shmem.c
--- a/mm/shmem.c~mm-memcontrol-move-swap-charge-handling-into-get_swap_page
+++ a/mm/shmem.c
@@ -1322,9 +1322,6 @@ static int shmem_writepage(struct page *
 	if (!swap.val)
 		goto redirty;
 
-	if (mem_cgroup_try_charge_swap(page, swap))
-		goto free_swap;
-
 	/*
 	 * Add inode to shmem_unuse()'s list of swapped-out inodes,
 	 * if it's not already there.  Do it now before the page is
@@ -1353,7 +1350,6 @@ static int shmem_writepage(struct page *
 	}
 
 	mutex_unlock(&shmem_swaplist_mutex);
-free_swap:
 	put_swap_page(page, swap);
 redirty:
 	set_page_dirty(page);
diff -puN mm/swap_slots.c~mm-memcontrol-move-swap-charge-handling-into-get_swap_page mm/swap_slots.c
--- a/mm/swap_slots.c~mm-memcontrol-move-swap-charge-handling-into-get_swap_page
+++ a/mm/swap_slots.c
@@ -317,7 +317,7 @@ swp_entry_t get_swap_page(struct page *p
 	if (PageTransHuge(page)) {
 		if (IS_ENABLED(CONFIG_THP_SWAP))
 			get_swap_pages(1, true, &entry);
-		return entry;
+		goto out;
 	}
 
 	/*
@@ -347,10 +347,14 @@ repeat:
 		}
 		mutex_unlock(&cache->alloc_lock);
 		if (entry.val)
-			return entry;
+			goto out;
 	}
 
 	get_swap_pages(1, false, &entry);
-
+out:
+	if (mem_cgroup_try_charge_swap(page, entry)) {
+		put_swap_page(page, entry);
+		entry.val = 0;
+	}
 	return entry;
 }
diff -puN mm/swap_state.c~mm-memcontrol-move-swap-charge-handling-into-get_swap_page mm/swap_state.c
--- a/mm/swap_state.c~mm-memcontrol-move-swap-charge-handling-into-get_swap_page
+++ a/mm/swap_state.c
@@ -216,9 +216,6 @@ int add_to_swap(struct page *page)
 	if (!entry.val)
 		return 0;
 
-	if (mem_cgroup_try_charge_swap(page, entry))
-		goto fail;
-
 	/*
 	 * Radix-tree node allocations from PF_MEMALLOC contexts could
 	 * completely exhaust the page allocator. __GFP_NOMEMALLOC
_

Patches currently in -mm which might be from tj@xxxxxxxxxx are


--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux