+ mm-swap-remove-lock_initialized-flag-from-swap_slots_cache.patch added to -mm tree

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

 



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

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-swap-remove-lock_initialized-flag-from-swap_slots_cache.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-swap-remove-lock_initialized-flag-from-swap_slots_cache.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
Reported-by: Wenwei Tao <wenwei.tww@xxxxxxxxxxxxxxx>
Cc: Ying Huang <ying.huang@xxxxxxxxx>
Cc: Minchan Kim <minchan@xxxxxxxxxx>
Cc: Rik van Riel <riel@xxxxxxxxxx>
Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Cc: Hillf Danton <hdanton@xxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 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@xxxxxxxxxxxxxxx are

mm-swap-fix-race-conditions-in-swap_slots-cache-init.patch
mm-swap-remove-lock_initialized-flag-from-swap_slots_cache.patch

--
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