mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [withdrawn] mm-swap-remove-lock_initialized-flag-from-swap_slots_cache.patch removed from -mm tree
@ 2017-10-04 21:54 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2017-10-04 21:54 UTC (permalink / raw)
  To: tim.c.chen, aarcange, hannes, hdanton, hughd, junaids, mhocko,
	minchan, riel, wenwei.tww, ying.huang, mm-commits


The patch titled
     Subject: mm/swap_slots.c: remove lock_initialized flag from swap_slots_cache
has been removed from the -mm tree.  Its filename was
     mm-swap-remove-lock_initialized-flag-from-swap_slots_cache.patch

This patch was dropped because it was withdrawn

------------------------------------------------------
From: Tim Chen <tim.c.chen@linux.intel.com>
Subject: mm/swap_slots.c: remove lock_initialized flag from swap_slots_cache

We will only reach the lock initialization code in alloc_swap_slot_cache
when the cpu's swap_slots_cache's slots have not been allocated and
swap_slots_cache has not been initialized previously.  So the
lock_initialized check is redundant and unnecessary.  Remove
lock_initialized flag from swap_slots_cache to save memory.

Link: http://lkml.kernel.org/r/867d1fb070644e6d5f0ac7780f63e75259b82cc3.1500677066.git.tim.c.chen@linux.intel.com
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Reported-by: Wenwei Tao <wenwei.tww@alibaba-inc.com>
Cc: Ying Huang <ying.huang@intel.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Junaid Shahid <junaids@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/swap_slots.h |    1 -
 mm/swap_slots.c            |    9 ++++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff -puN include/linux/swap_slots.h~mm-swap-remove-lock_initialized-flag-from-swap_slots_cache include/linux/swap_slots.h
--- a/include/linux/swap_slots.h~mm-swap-remove-lock_initialized-flag-from-swap_slots_cache
+++ a/include/linux/swap_slots.h
@@ -10,7 +10,6 @@
 #define THRESHOLD_DEACTIVATE_SWAP_SLOTS_CACHE	(2*SWAP_SLOTS_CACHE_SIZE)
 
 struct swap_slots_cache {
-	bool		lock_initialized;
 	struct mutex	alloc_lock; /* protects slots, nr, cur */
 	swp_entry_t	*slots;
 	int		nr;
diff -puN mm/swap_slots.c~mm-swap-remove-lock_initialized-flag-from-swap_slots_cache mm/swap_slots.c
--- a/mm/swap_slots.c~mm-swap-remove-lock_initialized-flag-from-swap_slots_cache
+++ a/mm/swap_slots.c
@@ -140,11 +140,10 @@ static int alloc_swap_slot_cache(unsigne
 	if (cache->slots || cache->slots_ret)
 		/* cache already allocated */
 		goto out;
-	if (!cache->lock_initialized) {
-		mutex_init(&cache->alloc_lock);
-		spin_lock_init(&cache->free_lock);
-		cache->lock_initialized = true;
-	}
+
+	mutex_init(&cache->alloc_lock);
+	spin_lock_init(&cache->free_lock);
+
 	cache->nr = 0;
 	cache->cur = 0;
 	cache->n_ret = 0;
_

Patches currently in -mm which might be from tim.c.chen@linux.intel.com are

mm-swap-fix-race-conditions-in-swap_slots-cache-init.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-04 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-04 21:54 [withdrawn] mm-swap-remove-lock_initialized-flag-from-swap_slots_cache.patch removed from -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).